Expression fails when trying to hide SSRS subreport - reporting-services

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.

Related

SSRS: Suppressing hidden row groups on Tablix when exporting to Excel

Can Excel render only the visible row groups on a report?
I have a report [SSRS 2017] that has nested row groups on the Tablix.
The child groups are hidden by default, toggled by a report field. When you run the report, the default view displays just the summary rows.
Folks naturally try to export this to Excel (to work with just the summary rows) and of course When they export to Excel (collapsed or not) they get the grouped child rows:
Is there any way for SSRS to suppress hidden row groups when exporting to Excel (while still having a working toggle on the web version of the report)?
My fallback is to duplicate the report, remove the child row groups altogether, and just link to the "simplified" version of the report for that purpose.
thanks!
I haven't done this before but I have seen the theory for this once.
You would want to add an extra column and use it as the Toggle Item. Then set the visibility for the new column based on whether it's an EXCEL export.
=IIF(Globals!RenderFormat.Name="EXCEL" or Globals!RenderFormat.Name="EXCELOPENXML", True, False)
I haven't seen it work, so I don't know if will work the way you want.
The solution above does not work if you want to hide detail rows shown by drilling down.
For this case there's another way:
Create a boolean parameter to "suppress details" for example ExcelHide.
Create a copy of the tablix you want to hide the details from.
Set visibility parameter of the ORIGINAL tablix to the value of the parameter. This will HIDE this tablix when the parameter is true.
Set visibility parameter of the COPIED tablix to the negated value (not ExcelHide) of the parameter. This will SHOW this tablix when the parameter is false.
On the COPIED tablix, hide all elements you do not want to export to Excel.
When the report is run you set the parameter so you can show the details for regular operation and hide elements to allow successful export to Excel.
Almost there! I achieved this by setting the DataElementOutput property in my Tablix to "NoOutput", then prefixing the following to any fields in the rows I wished to exclude from my CSV export:
=IIf(Globals!RenderFormat.Name="CSV",Nothing,[YourValue])
Hope this helps folk and thanks [#Hannover Fist].

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

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?

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:

RDLC report Error "Report item expressions can only refer to other report items within the same grouping scope or a containing grouping scope."

I need to display some value on textbox which this value will receive from Tablix.
But It's error this messesge
The Value expression for the text box‘TextBoxName’ refers to the report item ‘NameOfTexboxInTablix’.
Report item expressions can only refer to other report items within the same grouping scope or a containing grouping scope.
Letters in the names of report items must use the correct case.
In hidden tablix has a cell named "NameOfTexboxInTablix" which it use expression for getting value like this
=Lookup(Fields!SEQ_NO.Value,"NO_2",Fields!PROCESS_CODE.Value, "PART_PROCESS")
And I have three Textbox (outside tablix) . Three textbox use for display
a value from first row, second row and third rows of dataset.
-Textbox1 will show "PROCESS_CODE" of the first row.
-Textbox2 will show "PROCESS_CODE" of the second row.
-Textbox3 will show "PROCESS_CODE" of the third row.
So I refer to a cell which it' is textbox in tablix. Textbox named "NameOfTexboxInTablix". Textbox1,2 and 3 will refer by this expression
=ReportItems!NameOfTexboxInTablix.Value
But It's error.
How to solved this problem without combind dataset?
I have solved this problem.
My hidden Tablix was made to use a Lookup function.
Sometimes a Tablix will automatically create a grouping in the window below the designer (Row Groups). It is named "Details"
So I have solved this problem by deleting this "Details" Group.

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