Linking to a URL via a Lookupset with multiple results in SSRS - reporting-services

Is it possible to have a dynamic link within a lookupset function in SSRS?
I am joining several values from one Dataset to another using the Lookupset & join functions. Would it be possible for each value returned to point to a different URL address based on the value selected?
For example, I am using this function to return Tasks as a 1 to many relationship with their relevant projects:
=Join(LookupSet(Fields!Title.Value, Fields!Related_Project.Value, Fields!Title.Value, "TeamTasks"), Environment.NewLine() & Environment.NewLine())
For the returning values, is it possible to link them to their respective URL?
When I set the the expression for Hyperlink as follows:
="https://example/" & Fields!ID.Value
or
= "https://example/" & Lookup(Fields!Title.Value, Fields!Related_Project.Value, Fields!ID.Value, "TeamTasks")
It simply works for the first returned value and is not dynamic within the Lookupset function.
An example of the table would be:
Project Title Task
_____________ _____
Project 1 Task1
Task2
Task3
_____________ _____
Project 2 Task 1
Ideally, for each separate Task clicked, it will link you to the respective URL.
The Task column is populated via the Lookupset function within the same Row as Project.
Is there any way to fix this?
Thanks in advance!

One TextBox can points to only one URL unless you apply some trick.
If your output structure is ready as shown your sample. Follow the below steps:
Right Click on TextBox>Placeholder properties
Select option HTML
Put the expression, similar as below:
I have tested with my sample data. Make changes according to your value.
Update:
From your comment, replace the field Fields!URL.Value to Fields!Title.Value (this is the field https://example/Title1).
To give you the undestanding, What the below code is doing?
"" & Fields!Title.Value & ""
It will generate the HTML links for title values from your source data.
Title1
Title2
Title3
& Chr(34) & - This is to tackle the special character ".

Adding the prefix in your join criteria will make sure it appears in each separation, and then add one at the beginning. Try to modify your join like this (free-coded).
="https://example/" & Join(LookupSet(Fields!Title.Value, Fields!Related_Project.Value, Fields!Title.Value, "TeamTasks"), Environment.NewLine() & Environment.NewLine() & "https://example/")

Related

How can I find a specific value in an object?

I have a Parameters that is an object and contains a few value :
key
Value
0
Apple
1
Juice
2
Banana
So If I do Parameters!MyParam.Value(0) the result is Apple, and Parameters!MyParam.Value(1) the result is Juice, etc.
What I want to do is to see if my object contains a value like Banana and return true if it does.
Is it possible ? I didn't find anything the net. The closest thing that I found is inStr but it only works for strings...
A few things to point out here...
In SSRS a parameter is made up of a Value and a Label. What you describe as the Key would be the Value and what you describe as the Value would be the Label.
You can reference the Parameter's Label property using Parameters!MyParam.Label
It's not clear from your question but I assume you want to search your parameters to see if a specific value has been selected. If so then you can do that like this...
For this exmaple I have added the parameters values/labels manually but you can do this however you need.
Next I added, for demonstration purposes, some labels and fields to the report as follows.
The selected parameter's expression is
="|" & JOIN(Parameters!MyParam.Label, "|") & "|"
The 'contains banana' expression is
=("|" & JOIN(Parameters!MyParam.Label, "|") & "|").Contains("|Banana|")
The JOIN simply joins all the selected parameter labels togther, using the pipe symbol | as a delimiter. I then add a | to the start and end so the can search for |searchterm|. This avoids errors if, for example, you had "Pineapple" and "apple" in the parameter list and searched for "apple", it would show true even if only "pineapple" had been selected. By searching for "|apple|" we avoid this.
Once we have the join results we can then use the VB function .Contains() to search for what we want.
If I run the report and select all values I get this
If I select only Apple and Juice I get this

Expression in Textbox not passing value to the table

Obviously I am not an Access expert or I would not be asking this question. I created a small database with several tables. On a form, there are several combo boxes for the user to choose different combinations of medium, paper, sizes, etc. I have already created an expression that returns the correct value I need, but I cannot figure out how to get this value into the correct field on the table to store with the record the form is creating. Below are screen shots of the form and a couple of the tables. I have also included the expression I am using. I need the value that the expression returns to go into tbl1Artwork and populate the ArtWorkSKU field.
Expression:
=Left([PieceName],4) & [cbxArtist].Column & [cbxMedium].Column & [cbxPaperType].Column & [cbxPrintType].Column & [cbxSize].Column
The ArtWorkSKU text box is unbound as I had to type the expression in there. I am not sure if this is the correct way to accomplish the goal. In the tables below, except for the PK, all fields are Short Text.
All guidance is greatly appreciated.
Saving calculated data is usually not necessary and can be risky. Saved value can become 'out of sync' with raw data. Value can be calculated when needed.
Saving calculated data requires code (macro or VBA).
Can be as simple as Me!fieldname = Me.controlname.
Real trick is figuring out what event(s) to put code into. In your case, most likely form BeforeUpdate.
Advise not to use spaces nor punctuation/special characters (underscore only exception) in naming convention. Better would be ArtworkSKU or ArtworkSKUnum or Artwork_SKU_Num.
Create the following function in VBA:
Function UpdateSKU()
Me.ArtWorkSKU = Left(Me.[PieceName],4) & Me.[cbxArtist].Column(3) & _
Me.[cbxMedium].Column(2) & Me.[cbxPaperType].Column(2) & _
Me.[cbxPrintType].Column(2) & Me.[cbxSize].Column(2)
End Function
Then, on the form, update the After Update event property (not vba) of each "feeder" control to:
After Update: =UpdateSKU()

MS Access - Dlookup criteria from selected item (listbox)

I've seen similar questions but the provided answers couldn't solve my problem.
In access I created a form.
From a listbox you can select a name. The names are listed in the table tNames in the column names_combined (last name, given name) . In two other columns last name and given name are separated.
On the right side of the listbox you can find information about the name which will be shown in text boxes.
The goal is to show the last name from table tNames.lastname by looking for tNames.names_combined.
So I tried this:
=Dlookup("lastname";"tNames";"names_compined =" & Me.listbox)
However I just get error messages in my text box.
Thanks in advance!
DLookup requires commas not colons.
This should work assuming all the names of tables/fileds and controls are correct:
=Dlookup("lastname","tNames","names_compined='" & Me.listbox & "'")
Also make sure the actual bound field of your listbox is the combined name (by the way you code says comPined).
Finally as it was pointed out in the other answer me.something will only work in the form itself or its VBA module. Everywhere else you need a global identifier.
Try with:
=Dlookup("lastname";"tNames";"names_combined = '" & Forms!YourForm!listbox & "'")

SSRS Passing Parameters in an Action Expression based on contents of grid/cell

In my main table, I have a fairly complex query pulling 2 kinds of data and displaying them in one grid. Currently, if the user clicks on a value, they will be able to drill down into a breakdown of the data they clicked on. The problem is that I can only display data for one of the types of data.
I would like to display a breakdown of the other type but it would require displaying on a different report using similar parameters. I am looking for a way to pass parameters to sub-reports based on the contents of what I am clicking. For example (In the action expression) I have tried this:
=IIf(Fields!Type.Value = "Job", "/Production Planning/SupportReports/Job_Plan_Board_Job_BD_v1 & Parameters!ReqByDate.Value", "/Production Planning/SupportReports/Job_Plan_Board_Plan_BD_v1 & , Parameters!ReqByDate2.Value")
The parameter values are not passing. - I am pretty sure it is syntax as I have already tried everything I could think of with the parameter expressions...
If your fields are correct, you just need to fix your syntax. You parameters need to be outside of the quotes so the value can be appended to the string.
=IIf(Fields!Type.Value = "Job",
"/Production Planning/SupportReports/Job_Plan_Board_Job_BD_v1" & Parameters!ReqByDate.Value,
"/Production Planning/SupportReports/Job_Plan_Board_Plan_BD_v1" & Parameters!ReqByDate2.Value)
If the Type = Job and the ReqDate is 09152015 then the subreport name (? - not sure what) would be /Production Planning/SupportReports/Job_Plan_Board_Job_BD_v109152015.
Now that I think of it, you could shorten this a little bit:
="/Production Planning/SupportReports/Job_Plan_Board" &
IIf(Fields!Type.Value = "Job",
"Job_BD_v1" & Parameters!ReqByDate.Value,
"Plan_BD_v1" & Parameters!ReqByDate2.Value)

SSRS 2005 Report Preview: Object reference not set to an instance of an object

This is my error and I have read through many of the fixes for this on the site, though none of them seem to address what I am seeing.
I can run my report just fine and the data displays correctly.
My issue is that I am building a hyperlink off of the columns.
I know its one column that is the issue as when I eliminate it from my hyperlink it forms just fine.
My Hyperlink is this:
=Fields!websiteURL.Value & "customer.asp?customerId=" & Iif(Fields!isGuidYN.Value="Y","{","") & Fields!customerId.Value.ToString() & Iif(Fields!isGuidYN.Value="Y","}","") & "&loanId=" & Iif(Fields!isGuidYN.Value="Y","{","") & Fields!loanId.Value.ToString() & Iif(Fields!isGuidYN.Value="Y","}","")
if I eliminate the Fields!loanId.Value.Tostring() the link builds without error (but is no longer useful). Have also tried Fields!loanId.Value.Tostring and Fields!loanId.Value (as this is a string value from the db)
I have tried to hardcode the value from the SQL draw that is that field. 'Test' as loanId and the string comes out fine.
The text box that displays the value on the report is fine and the text is normal on the report. So the data is there, its in the field that displays it, but the hyperlink is not built correctly.
Its just building the Hyperlink gives that error.
The entirety of the error is:
[rsRuntimeErrorInExpression] The Hyperlink expression for the textbox ‘textbox10.ActionInfo.Action’ contains an error: Object reference not set to an instance of an object.
This is not a trickle down error as it is the last one and when I remove the value from the hyperlink the report comes out with 0 errors and 0 warnings.
Any insights would be phenomenal.
Thanks
T
Can you try this expression:
=Fields!websiteURL.Value.ToString() & "customer.asp?customerId=" & Iif(Fields!isGuidYN.Value.ToString()="Y","{","") & Fields!customerId.Value.ToString() & Iif(Fields!isGuidYN.Value.ToString()="Y","}","") & "&loanId=" & Iif(Fields!isGuidYN.Value.ToString()="Y","{","") & Fields!loanId.Value.ToString() & Iif(Fields!isGuidYN.Value.ToString()="Y","}","")
and also make sure that you are using all fields names as it is appearing in dataset. Because in ssrs, names are case sensitive.
OK this wasn't what I was looking for but the report came through when I did something rather foolish..right in that category of "That can't possibly help but let's try it anyways..."
So originally I had a select statement like..
SELECT ...,
loanId,
...
FROM ...
When I ran this I got the loanId but it wouldn't parse the value to a string in order to make it a URL. The value appears in the field on the report, but it doesn't bring it across to the URL.
I even did this:
SELECT ...
'Test' as loanId,
...
FROM ...
That gave me the URL and the report liked it, but of course its not a valid URL for my purposes.
So I wound up doing this and the report likes it, builds the URL and I have no idea why
SELECT ...
loanId,
loanId as loanId2,
...
From ...
Now the report likes both the loanId field and the loanId2 field parses to the URL correctly.
Sure its ugly. But I spent way too much time trying to figure it out