Combine multiple query results into single parameter
Hi, I am trying to set a parameter value as follows: =IIF(Parameters!WorkItemSystemWorkItemType.Count=2, Parameters!USIds.Value & Parameters!BugIDs.Value, IIF(Parameters!WorkItemSystemWorkItemType.Count=1, IIF(Parameters!WorkItemSystemWorkItemType.Label="User Story", Parameters!USIds.Value, Parameters!BugIDs.Value), Nothing)) If the first IF statement is true, then I want to combine the outputs of two other queries. However, when I try to do this, I get an error along the lines of: Operator '&' is not defined for type Object() Is there a way for me to combine the two query outputs into a single parameter value list?
August 14th, 2012 2:12pm

When you say combine, say USIds = 1320 and BugIDs = 3210 and they are both type integer, you want the output to be 13203210, as integer or string? Probably add CStr or CInt will work, good luck. =IIF(Parameters!WorkItemSystemWorkItemType.Count=2, CStr(Parameters!USIds.Value) & CStr(Parameters!BugIDs.Value), IIF(Parameters!WorkItemSystemWorkItemType.Count=1, IIF(Parameters!WorkItemSystemWorkItemType.Label="User Story", Parameters!USIds.Value, Parameters!BugIDs.Value), Nothing))Think out of the box
Free Windows Admin Tool Kit Click here and download it now
August 14th, 2012 2:46pm

The IDs will be passed as a string and both are multi-value. Here is an example of what I'm trying to do: USIds= [Work Item].[System_ID]&[25], [Work Item].[System_ID]&[26] BugIDs= [Work Item].[System_ID]&[27], [Work Item].[System_ID]&[28] I want the output to be the following: [Work Item].[System_ID]&[25], [Work Item].[System_ID]&[26], [Work Item].[System_ID]&[27], [Work Item].[System_ID]&[28] I have tried CStr function and get an error.
August 14th, 2012 3:14pm

oh, a multi-valued parameter is an array, so you cannot convert it straight to string. You must use the Join function. =IIF(Parameters!WorkItemSystemWorkItemType.Count=2, Join(Parameters!USIds.Value,", ") & ", " & Join(Parameters!BugIDs.Value,", "), IIF(Parameters!WorkItemSystemWorkItemType.Count=1, IIF(Parameters!WorkItemSystemWorkItemType.Label="User Story", Join(Parameters!USIds.Value,", "), Join(Parameters!BugIDs.Value,", ")), Nothing)) Not quite sure if my '( )' are good, but it should give you the general idea.
Free Windows Admin Tool Kit Click here and download it now
August 14th, 2012 4:01pm

Correct. When concatenating multivalue param, use built-in function JOIN. Good luck.Think out of the box
August 14th, 2012 5:18pm

Ok - so it's getting beyond the previous error, but still not running. I have the above referenced Join text in the Parameter section of the Dataset. What do I need to define within the parameter itself? I tried to add it there as well and it doesn't seem to want to run that way either.
Free Windows Admin Tool Kit Click here and download it now
August 15th, 2012 9:37am

I am not really sure what you are trying to achieve. Could you explain a little bit more your situation?
August 15th, 2012 10:37am

I am using the TFS cube as a source, if that makes any difference. For this report, I want to give users the ability to select Bugs, User Stories, or both in a single data region. To pull relevant bugs and user stories, there are different query requirements, so I have a separate query for each. I am then trying to feed the relevant bug and user story IDs via a hidden cascading parameter to another query that will be used for the report data region. So, if a user selects both bugs and user stories, the IDs from the two separate queries should be combined for the third query. If only one is selected, only the IDs from the associated query should be cascaded.
Free Windows Admin Tool Kit Click here and download it now
August 15th, 2012 11:01am

Getting closer, but SSRS doesn't seem to like using a comma or blank space as a separator. Any ideas?
August 31st, 2012 11:16am

Turns out I needed to add the Split function in addition to Join. This is what is working: =IIF(Parameters!WorkItemType.Count=2,Split(Join(Parameters!USIDs.Value, ",") & "," & Join(Parameters!BugIDs.Value, ","), ","), IIF(InStr(Parameters!WorkItemType.Label(0), "Bug")>0,Parameters!BugIDs.Value, Parameters!USIDs.Value)) thank you for your help.
Free Windows Admin Tool Kit Click here and download it now
August 31st, 2012 2:55pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics