Multiple values to subreport [duplicate] - reporting-services

This question already has an answer here:
Link Subreport to matrix
(1 answer)
Closed 9 years ago.
I a matrix which shows count of Invoices (InvoiceID) with countries on rows and years on headers
Country 2001 2002
US 100 300
UK 200 400
IR 500 90
I have requirement of creating a subreport which shows Invoices details. When I click 100(US-2001) on my main report I have to show all the 100 Invoices. I tried this way: since I am doing count of InoviceID in matrix, I tried using Join(Fields!InvoiceID,", ") expression on the data text box action (Go to report). on the other side I created a subreport with multivalue parameter. but this approach dint work. Later I discovered that Join will not work rows as it expects only arrays.
later I used Join(LookupSet(1,1,Fields!InvoiceID.Value, "DatasetName")," / ") I could join the invoice ids but the problem is, this expression joins all the invoice ID in complete dataset. I just need US-2001 invoices to take to my subreport.

Your subreport should have two parameters:
#Year
#Country
With those two parameters, the subreport can find the clicked invoices. For example, if the following values are passed:
#Year = "2001"
#Country = "UK"
Then it should be able to find those "200" invoices and display their details.
If you base both the main report (that shows COUNT(InvoiceID) and the subreport (that shows Invoice.* details) on the same view, you're pretty safe in getting consistent results in both reports.
With the "Go to subreport" action you should be able to fill those parameters.

Related

SSRS Multi Value Parameter

I have a report having two tab-lix and also two data set(e.g=dataset1,dataset2) for each tab-lix. When i am generating report by passing the multiple parameter location id(38,39 & 40) value if there is no record of id-38 in dataset2 i want blank space but in my report it is showing report of 39. But i want if there is no data in data set based on the parameter it is showing only blank space.Because always dataset1 having data and so it showing properly.When i am generating report with multiple parameter(38,39,40) it showing tablix1 of 38 parameter but tablix2 of 39 parameter in on page because of there is no data in dataset2 of 38 parameter.So i want to display a blank space on behalf of tablix2 if there is no data.
Give me a solution.
This answer assumes you have a table that contains all locations e.g. DimLocations, if not you should consider creating one.
You can then change your dataset query to be something like.
SELECT loc.LocationID, t.SomeColumn, t.AnotherColumn
FROM DimLocations loc
LEFT JOIN myTable t ON loc.LocationID = t.LocationID
WHERE loc.LocationID IN(#myLocationParameter)
This will ensure that you get a record for each location as long as it appears in the DimLocations table.
If this does not help, edit your question to show the dataset query you are using now and the structure of your locations table (if you have one)

SSRS report pass multiple VALUES to drill through report parameter

I created a report with 5 fields in a hierarchical order:
Order Date
Time of Day (AM/PM)
Parent Name (aka customer)
Product Line
BIC Part Number (aka Item)
Each field expands down to the next level, so order date expands to time of day, etc.
I want to create a drill through report so that the user can click on each level of the hierarchy and see the detail.
This works fine at the lowest level - Item - because only 1 values from each field has to be passed to the drill through report parameter. However, when I try, for example, to drill through based on Product Line, there will usually be 3 or 4 Items within this product line. In the Go To action, I have the drill through parameter "bic_part" set to the main report FIELD value "BIC Part Number".
I have the tablix on the drill through report set where "BIC Part Number" IN [#bic_part].
I just want to be clear, I am passing a set of report field values to the drill through report parameter, not parameter to parameter.
I have tried using expressions with =Split(Join(field value),","),",") and all variations on that. I can't seem to get the child report filters to accept multiple values from the BIC Part Number field from the parent report.
I also tried omitting the BIC Part Number value in the go to report section, but it would not let me.
All of the parameters in the child report are set to accept multiple values. My data source for both reports is the same stored proc, so I can add a query filter. I would appreciate any help.
I think each sub report link needs to be slightly different.
In the subreport, each parameter needs to accept null and your query needs to look for
(FieldName = #FieldNameParameter or #FieldNameParameter is null)
This will allow you to pass the lowest possible solid value, then null for all child values.
If we're looking at the Parent_Number level, on that subreport link you would pass Fields!Parent_Number.Value and then Nothing for each of the lower parameters (Product_Line, BIC_Part_Number).
This will allow you to filter on the lower common denominator in your sub report - Part_Number for this link, Product_Line for the next one down, etc.
I've used this logic in reports before, so it does work. Let me know if my explanation needs clarification - it's Friday afternoon..

How to pass multiple values to a multivalued parameter in SSRS

I will try to explain the issue as best as I can by oversimplifying the report structure. Report one contains 1 group called ResourceCenter and then one line of totals under it. The totals are actually a group but the grouping is done in SQL and are presented in a detail group. The report looks something like this:
Report 1
ResourceCenter 1
Total1 11
Total2 4
Total3 8
ResourceCenter2
Total1 12
Total2 11
Total3 6
From this report, I need to drill through to another report that has a bunch of multi-valued parameters. For the drillthrough, I am able to use single values for everything except for EmployeeNumber. For that, I need to be able to pass a list of EmployeeNumbers to the multi-valued parameter in Report 2. The EmployeeNumbers are not currently present in any DataSet or parameter in Report 1 but are based on ResourceCenter. So, if the user has run Report 1 and clicks on ResourceCenter 1, I need to be able to pass a list of EmployeeNumbers associated with ResourceCenter 1 to the multi-valued parameter in Report 2 in a way that Report 2 will handle it correctly.
NOTE: I should add that I have created two SQL functions that accept an input of ResourceCenter and then return a list of employees. One is a table-valued function that returns a single column of EmployeeNumbers. The other is a scalar-valued function that returns the EmployeeNumbers as comma-separated values. I then have some custom code that runs the SQL function in the background and returns the list. I have not had any success with returning a dataset that SSRS can use but I have been able to get the scalar-valued function to 'work' in the sense that I can create a field on a dummy report and see the output. I have not had any luck getting Report 2 to accept a comma-separated list, though.
This person was doing a drill-through and appears to have solved a similar problem with a multi-value parameter. In that case it had to be formatted for an IN clause.
=SPLIT(JOIN(Parameters!SomeParameterName.Value,","),",")
If Report2 won't take it in this format, you might have to add a separate single-valued parameter that will accept a comma-separated string, which you then have to parse.
I'm using SSRS 2016, and my datasets are based on stored procedures, but passing multi-value parameters to a drill down doesn't seem to be an issue anymore. By default, when you select a multi-value parameter it gives you something like Parameters!ParName(0).Value which would pass just the first value. But if you remove the (0) and just leave it as Parameters!ParName.Value, it seems to be passing all values fine.

Link Subreport to matrix

I have a matrix like below. years on columns and countries on rows.
Countries 2001 2002
US 100 400
UK 200 290
IR 300 89
I have a requirement of creating a subreport which shows Invoice details. When I click 100 (US-1002) on my main report I have to show all the 100 Invoices. I tried this way:
Since I am doing count for InvoiceID in matrix, I tried using Join(Fields!InvoiceID,", ") expression on the data test box action(Go to report). On the other side I created a subreport with multivalue parameter. But this approach dint work. I found that Join will not work with data rows as it expect arrays.
Later I used Join(LookupSet(1,1,Fields!Name.Value, "DatasetName")," / "). I could join the invoice ids but the problem is , this expression joins all the invoice ID in complete dataset. I just need US-2001 cell (100) invoice ids only to take to my subreport
From your description, it sounds like the easiest thing to do would be to set up the subreport to take two parameters, Country and Year, instead of trying to pass the list of invoices.
The subreport can then report all the invoices for a particular Country and Year combination.
It would be simpler to just set up the drillthrough to accept the two fields for its parameters, as above, instead of try to work out an expression for all the invoices in a particular cell's scope.

In SSRS is there a way to make a Row Group expand based on parameter value?

I've got a table with 5 columns, the first 3 of which allow the user to drill down through the levels of detail. Each of these columns (Region, Country & Office) has an associated Parameter so the user can select the geographic region for their report. Each parameter allows the selection of multiple values.
If the user selects 1 Region, 1 Country and 1 Office it's not exactly ideal for them to then have to expand each selection. Is there an expression I can enter somewhere to state that if only 1 value is entered in a parameter then that data set will automatically show as expanded?
This is in SSRS 2008 R2 if that makes any difference.
In the Group Properties for the detail group you can enter an expression for the initial visibility. Right now you probably have that set to "Hide." The expression needs to return a Boolean and could be something like:
=Parameters!Country.Count <> 1
This will have SSRS hide those rows if more (or less) than one value are selected in the parameter Country
But I have seen some unexpected results with this: test thoroughly. In my experience, BIDS handles these better than SSRS itself, so just when you think you've got it all working, it fails miserably once deployed. (Reason number 14 to have a test folder on production SSRS.)