How to group my subreports into 1 header & 2 details output - reporting-services

Currently I've created below report with total of 3 subreports, the expectation was using DN_Header as main header sub report for PickSlip header & PickSlip details.
But it seems the output I'm having now is totally a mess whereby "DN_HEader" only show 1 of the data & applied toward all sub reports which is not right.
So how can i make it into such output? I'm not familiar with the grouping if there's any good reference that will be great. Thanks

You will need to create a few sub reports. You may have most of them completed already but I'll go thru them.
Here's a rough sketch of the layout based on your expected output image.
NOTE: Subreports A and B could be combined into a single report. It depends if you plan to use any parts elsewhere. Combining then might make this a little easier.
Subreport A. This is just you details section. It should accept parameters to filter data as applicable.
Subreport B. This will be your details header plus your details body. Again it must accept parameters to filter data as applicable.
SubReport C. This will contain a header and a single cell tablix. This will contains a dataset that returns 1 record for every instance of subreport B that needs to be shown. It will contain a tablix with a single cell. The tablix's dataset will point to the new dataset. In the cell, insert a subreport and set it to point to SubReportB. Finally pass in parameters from the dataset tho the subreport (in the subreport properties) so SubReportB shows the correct data.
Main report. This will be very similar to subreportC, it will contains a single cell tablix containing SubReport C in it's cell and dataset that will be used to loop thru each required instance of SubReport C
Hope that makes sense?

Related

Expression fails when trying to hide SSRS subreport

In my main report I have one subreport for now. The subreport is linked and runs when I run the main report.
However, taking things step by step, I am trying to hide the subreport based on a field called "CL_Language" that has either "Spanish" or "English".
So main report runs and shows all subreports with both languages. This works.But now I am trying to hide any subreport where the "CL_Language" field.value is not "Spanish".
This is my Expression in the Visiblity property of the subreport control on main form:
=IIF((Fields!CL_Language.Value, "DataSet1")="Spanish",True, False)
I would assume I need to reference "DataSet1" since that is what the subreport is using but I get this error:
Overload resolution failed because no accessible 'IIf' accepts this number of arguments.
So I tried without referencing the DataSet1 in the expression:
=IIF(Fields!CL_Language.Value="Spanish",True, False)
And I get all records, Spanish and English as if it doesn't see the value.
The main report has no other controls on it, is only there to show hide based on language.
I have searched for other threads that have a solution with no luck.
EDIT:
As requested in comments here is my subreport layout.
In order to create 4 printable pages per Detail row I added a ListBox to the report and added first row as Parent Group, grouped on Row ID and set Page Breaks at every instance of new group. A rectangle holds the contents of the first page. Then for the next 3 pages I "Inserted row", inside group and below.
Each one of those rows holds a rectangle with all sorts of textboxes with values from the DataSet1. So all 4 pages print for each Parent group detail. I tried setting the Visibility property in the ListBox the same way I am trying to set the subReport's Visibility property but no luck.

passing multi valued parameter to sub report in SSRS

I have built a report which lists all the loans that are available for a specified date range(below is the screen shot of the report).There are a number of filters and data logic involved in pulling this report.The numbers high-lighted in yellow are the total no of loans in each bucket.When the user clicks on the totals I need to open a sub report with all loans falling in that bucket.I have created a sub report which accepts loan numbers as a parameter and set it to allow multiple values. Set the text box properties on the main report to go to the subreport when clicked on the totals.But I am unaware of how to pass multiple loan numbers from the main report to sub report.
Any help would be much appreciated.
What I am currently doing is passing required filters/details to the sub report , so that it can reevaluate. Reevaluating the report takes a lot of of time as there are many condition that need to be evaluated. It would be quicker if I could send the list of loan numbers.
Rather than pass a list, you'll need to pass in enough detail so your subreport can reevaluate and come back with the same set of loans.
This might be a little simplistic but base on your screen show you would pass in the Date Range column value. I'll assume for now (as I have no more information on your data) that the column is just a text column as it appears above.
So you sub-report would accept a daterange parameter and you would pass this as =Fields!DateRange.Value. The subreport would then do something like..
SELECT * FROM myLoansTable WHERE DateRange = #daterange
If there are more parameters set in the main report, you may need to pass those too so your subreport gives the same set of loans as displayed in the main report.
Hope that makes sense.

How can I append the results of additional queries to an SSRS report?

I am generating an SSRS report whose results are displayed like so:
I need to append similar query results (same exact query, one different parameter value) to the right of this data, so that one additional result set of data (from a 2nd query) would look something like this (but with different data, of course - this is just copied-and-pasted to show what's needed):
How can I add multiple of these similar-but-distinct result sets so that they can be read from left to right as shown above?
Solution: COLUMN GROUPING
If I have understood your question correctly, you are expecting to show those 3 columns repeatedly for different set of values. All you need to do is put those 3 columns in a group (Column Group) and Group by on whatever "Field/Parameter" you want to it repeat. Let me know how it goes!!
Based on what is written here, this is how I accomplished this:
I created a new report based on the existing one, and then added a Subreport and then dragged the existing (original) report onto it (I dragged "VariancePricebyProduct_Facelift.rdl" onto the subreport in "VariancePricebyProduct_Facelift_WithSubreports.rdl"). Then I selected the context menu item "Subreport Properties" and added a parameter ("Unit"), providing it with a "hard-coded/baked-in" value ("CHOPHOUSE") different from the one to be provided by the user for the main report.
Then, since I want to keep the same date values from the existing report, I added two more parameters to the subreport and set them to use the same values for the date range as those used there in the main report by selecting the "formula" ("fx") button and 2-clicking the appropriate parameter to be used as the passed-in (tramp) value:
That works. Just to make it plainer, here is how it looks at design time:
The mess at the top is "VariancePricebyProduct_Facelift.rdl"; the bit below is a Textbox/Label for the subreport and then the subreport itself.
And here is how the data looks where the original/base report finishes and the subreport begins:

SSRS Pull Variables Or Values From Sub Report Into Main Report

I have a main report with several sub reports, each of these with slightly different queries and different ways to show the data.
So, in my situation, I have a textbox that needs to compile data from a few different reports with varying criteria. E.G.
MainReportTextbox =(Sum(columnA, "Main Dataset"))-(SubReportTextBox))
OR
MainReportTextbox =(Sum(columnA, "Main Dataset"))-(subReportVariable))
I saw a few suggested solutions, such as this. Which uses the =[Reports]!MainReport!SubReport!Textbox scheme. The problem is that [Reports] is not a recognized identifier.
I did consider to scrap sub reports and just have everything run on the same main report, but we lose the functionality of being able to use the reports individually, without maintaining the same thing in two places.
So I guess my question is, can you pull variables or element(particularly textboxes in a table) values from sub reports?
If the answer is simply no, please show me some information about why it is no or how it is no from MSDN or a valid source and give some valid counter suggestions.
The links in the question and comments sometimes refer to non-SSRS reports: the syntax [subreport].[Report]![MyFieldName] or [Reports]![YourReportName]![YourSubReportName]![TheValueFromTheSubReportYouWantToReference] are not used in SSRS. It is, however, used in designing MS Access reports, as ojeffrey points out in the discussion you link to.
There is no common method to access data in a subreport. The SSRS model is that parent report data is processed, subreport data is processed, the subreports are rendered, results go back to the parent, then parent is rendered, including the subreport as appropriate. The only data passed between the two is parameters are passed into the the subreport, and rendered output is passed back to the parent. You'll see the that data passed in from the parent must be as report parameters here: http://technet.microsoft.com/en-us/library/ms160348(v=sql.100).aspx
All parameters that are required by the subreport must be included in
the Parameters list. If a required parameter is missing, the subreport
is not displayed correctly in the main report.
For citing authoritative sources:
This discussion sums it up:
No, referring to a report item in a subreport is not allowed.
But that is a bit old, there is also this more recent discussion of work-arounds, provided by Microsoft employee and a MS BI MVP:
You are going to need to replace the subreport item with a data region
like list, table, or matrix to be able to get the proper reference you
are looking for.
[Skipping down to another post]...
Now, it seems you want to calculate the
difference between main report and the subreport. Also, because they
have the different data source, so you cannot use nest
table/matrix/list, right? If so, one workaround I can think of is
pass parameter to the sub report and calculate the total/subtotal in
sub report. I mean, create several hidden/ internal parameters, pass
the values from main report to sub report through parameters and then
calculate the total/subtotal there.
Jeroen's answer to the linked question point towards the direction I would go: use a "Shared Dataset" and enable caching if the dataset is slow to execute. The same dataset execution can then be used for the parent and subreports. This can change the use of parameters: they usually get moved from the SQL query to the filter of the Dataset in the report.
But with the Lookup function introduced in SSRS 2008R2, you can get very flexible with report level joins between datasets.
The details of how I'd design this depend a lot on how much other data needs to get passed back and forth, and how neatly the queries for the reports can be knit together.
Create variable in main report and update it in sub report so you can get value back to main report
ex:
Create formula in main report with name {#Total} place flowing in it
WhilePrintingRecords;
shared Numbervar myTotal := 0;
NOTE : placing ; will not print value and without ; will print value in above example value will not be printed if you want to print value of formula just remove ; from second line ex
WhilePrintingRecords;
shared Numbervar myTotal := 0
now place {#Total} in report header of your main report
now create second formula in sub report where you want to add subtotal to main report formula with name {#addTotal} place following lines in it
WhilePrintingRecords;
shared Numbervar myTotal;
myTotal := myTotal + 200; //or any formula or field
add this formula to place in sub report where you want to add value to total
now create formula in main report to show grand total with name {#showTotal} and place following lines in it
WhilePrintingRecords;
shared Numbervar myTotal;
myTotal
place {#showTotal} in your main report where you want to show this value in report but remember one thing you should place this formula after sub-report.
NOTE : to assign value to variable use := operator

Dynamic subreport in SSRS 2008

I would like to set up a dashboard report in SSRS that contains a bunch of sub reports, but have the reports that are displayed be configurable at run time.
I.E. there could be 4 parameters which represent the names of 4 reports. The report contains 4 reports, and the name of each sub report should be taken from one of the parameters.
It looks like I can't do this, as the 'Use this report as a subreport' property is a dropdown and doesn't provide a way of configuring it as an expression.
Am I right?
Thanks,
Rich
I figure your scenario is just to display one at a time. I needed to do almost the same thing. I have a main report in which I wanted a dynamic number of different subs to be displayed. I solved it like this:
A main report (Main) with a tablix containing a subreport (SubMain), the dataset for Main passes id, subid and subtype. SubMain has no dataset.
And directly in the SubMain I added all my subs (SubDetail) which have their own dataset.
And then I set visibilty for SubDetails depending on type.
/Erik
Normally you'd have to define each subreport in the main report and then set visibility. Or use drill through to emulate navigation.