Reporting Services conditionally hide fields - reporting-services

I have a report where I have about 5 fields right next to eachother that dont return data in about 90% of the reports. Is there a way to hide these fields if they are empty otherwise display them if they do contain data?
Thanks

You can suppress columns conditionally in the report designer in SSRS, by selecting the table column and editing the Visibility>Hidden property (in the Properties window) to be the suppression condition.
Note that if the suppression condition is False at any point in the report, the columns will be displayed throughout the whole report.

Yes, you can write VBScript in the RDL file to display the field if it is not Nothing and the like.

Related

SSRS Create As Many Tables As Needed (Using One Dataset) Based on a DataSet Field

I have a query that returns relevant data about inspectors and how long it takes them to respond to issues. The only parameters are a BeginDate and EndDate so for any given date range there could be anywhere from 0 to 100 inspectors.
I am using only one dataset and it contains an "Inspector" field that I'm hoping can be used as a filter to create as many tables as there are inspectors.
I know you can set filters on tables but from my (limited) SSRS knowledge, you must already have the tables created and the filters are typically hard-coded. What I need, is some way for the report to see how many Inspectors there are in the dataset and group those records into their own tables, repeating the same one created tablix over and over as needed.
This is being done strictly in SSRS 2012, not using a ReportViewer where back-end code could help me out unfortunately...
I don't have any code examples to provide, like I said I know you can do filtering but I am at a loss when it comes to doing something like this dynamically based on data... Sorry.
Depending on the report design you could either...
Single report with grouping
1. Create a single tablix.
2. Create a row group by Inspector and then add whatever fields you need to the details section.
3. You can optionally set page breaks between instances of your Inspector rowgroup from the rowgroup properties.
Sub report method
1. Create a subreport that accepts a parameter (InspectorID for example).
2. In the subreport filter the dataset using the parameter passed in so it only return data for a single inspector.
3. Add whatever controls you need to the report to handle a single Inspector
4. Create a main report
5. Add a dataset that gives you a simple distinct list of Inspectors, this will be used to pass parameters to the subreport.
Lets assume it just contains a list of InspectorIDs.
6. Add a list control to the report and set it's dataset property to the dataset that contains your list of InspectorIDs
7. Right-click in the list control's 'cell' and insert a subreport.
8. Set the subreport property to the subreport you created earlier and set that parmameter IsnpectorID to your InpsectorID field.
This will produce a subreport for each instance of inspector it finds.
Sorry about the format of this answer, in a rush!

Is there any way to hide SSRS report paramteres using expressions?

I have created one report in SSRS-2012. I need to show/hide(not inactive) one parameter based on one formula. Is it possible. I am using Visual studio 2010 for my front-end development and report viewer control for showing the report.
Help me please
Currently there is no way to dinamically hide parameters in SSRS. Depending on your requeriments you may have two ways to handle this issue.
Create one subreport for all parameters and another subreport that does not include the parameter you want to hide, then show dinamically the subreport to the user based on your expression.
Other option is have another parameter set as internal. And conditionally populate that parameter based on your expression. If your condition yields true, populate the parameter with the user selection, otherwise use a default value or populate it to null. At presentation level your parameter keeps appearing but the user selection will take effect only based on your expression.
I think the second option is easier, let me know if you need further help.

Add a Filter to SSRS

I need to add a filter to a Report, that within anotherreport, the filtered results appear in the drilldown report.
For example: An .rdl file displays the first report, in that report a link can be clicked to access another report (.rdl) file. The report that displays after clicking link should be filtered by option selected from the first report(.rdl).
How could this be done? My thought that two datasets in each report could provide the information for the filter, however the filter expression is not valid this way...? I know this may not be the best way to do this.
So creating a drilldown report would be more acceptable. Creating one report and including a dataset with it by setting parameters to be called in the drilldown.
Does there need to be two datasets for each report to do this? I was assuming that the filter expression be written to do this: Field!.name.value AND Field!.name.value, etc to the whatever value I need to compare to or by.
Could this be a shared dataset to do this?
I was able to solve or partially solve this. I created a new report, with a query with the necessary columns that I needed in report 2. The drillthrough report(report 2) is linked from a textbox from a report allowing a user to view the information they need by clicking a link that displays the new report(passing the parameters from report 2 to the new report). If anyone has trouble with this, the simplest way would be to create one report and pass parameters to report two with parameters created from whatever query you want to use that has the values you want as columns in the report.

SSRS 2005 report with multiple datasets need to change parameter

All,
I've been working on a custom timesheet report that uses multiple datasets (8 to be exact). Each dataset selects the data by the same ID field which is currently input as a parameter. It works great like that. But now I'm told that the end user wants to input a date and have all the reports printed out for that date rather than having to enter in an ID each time. Each timesheet is 2 - 3 pages. It is intended to emulate a form and contains some data but a lot of blank areas to allow the field people to write in any changes that have occurred.
My question, is this: what is the best way of accommodating the new requirement? Should I build it all as one big dataset and use the date as a parameter?
Should I create a wrapper report that would prompt for the date and then use the existing report as sub report? Would that even work?
Is there any way I can just create a new date parameter and put that ahead of the ID parameter and get them to print out like that? I've got a few hidden parameter fields on the body that get used in the page header and are used to link some of the datasets.
any help is appreciated.
Easiest way to achieve this is indeed by creating a wrapper report with the date parameter. The data set in this report will then fetch all items (with ID) that match the query by the user. The report can then have a list for that dataset, with the original report as a subreport. If you pass the ID parameter from the dataset to the subreport you wouldn't need to change hardly anything in the original report.
Two things to watch out for:
the Report Header and Footer in a subreport are not rendered - these are only rendered for the wrapper report
you may need to tweak your page breaks in the subreport and on the new list in the wrapper report so each new form starts on a fresh page

Sql Server 2008 Reporting Services: Using two dataset error

Im building a report that's using two datasets. when I preview I find these types of errors...
Error 19 [rsFieldReferenceAmbiguous] The Value expression for the text box ‘Textbox3’ refers directly to the field ‘PerZipCode’ without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope.
What aggregate function is needed and where is there an option to set this?
If you are adding multiple datasets to a report, the above may not fix your problem. You may just get the following error when you aggregate it:
[rsMissingAggregateScope] The Value expression for the text box ‘textbox6’ uses an aggregate expression without a scope. A scope is required for all aggregates used outside of a data region unless the report contains exactly one dataset.
What you may need is something like :
First(Fields!MyField.Value, "DATASETNAME")
Which you can get by using the Expression Builder, rather than the drag and drop of fields from the dataset.
Min or Max or Avg etc: most of these
The aggregate is needed to reduce the other DataSet to one value (max of values etc) because you are using something not in the local scope (eg the DataSet bound to the Data Region). There is no way to match rows in the other DataSet with the local scope DataSet.
If your text box is standalone (not in a Data region), the same applies: the aggregate is needed to tell SSRS which row to take (Max etc) or what calculation to do on the dataset (Avg etc)
To use multiple dataset value on SSRS report we need to use below code.
First(Fields!MyField.Value, "Datasetname").
If by typing this you are still getting the same problem then right click on textbox & select expressions then in expressions click on Dataset. Select you dataset & then double click on required column. After this click on ok.
If you have multiple controls then follow the same for all of them & verify the same by executing the report.
If you already have an aggregate and are having this error, it is probably because the fields of the report aren't up to date with the dataset(s). You can fix the issue by refreshing the fields of the report.
To populate the field collection, use the Refresh Fields button on the Dataset Properties dialog box.
The field collection does not appear in the Report Data pane until the Dataset Properties dialog box closes.
To refresh the fields for a specific dataset
In the Report Data pane, right-click the dataset, and then click Dataset Properties.
Note :
If the Report Data pane is not visible, on the View menu, click Report Data. If the pane opens as a floating window, you can dock it. For more information, see How to: Dock the Report Data Pane.
In the Query pane, type the query. Alternatively, you can use the Import button to import your query from another .rdl file.
Click Refresh Fields.
Click OK.
In the Report Data pane, expand the dataset node to view the currently defined field collection.