SSRS Parameter value list always empty - sql-server

I'm using the new Report Builder for SSRS in SQL Server 2019, and I'm trying to create a paginated report with one multi-value parameter.
I've given my report two datasets, both from the same shared Data Source. One data set is all the report data, and the other just return as distinct list of keys from the first dataset.
Both queries run and return their expected values in the query designer. However if I create a multivalue parameter and set the available values to a field in that query. I get a blank list every time, and the entire report is also blank, even though I don't have the report configured to do anything with that parameter yet.
What am I missing? I am using the same cached sql login on the report, data source, and datasets, and the query definitely returns values.
If I remove the parameter from the report, then everything works as expected.

Related

How can I select all parameters to run a report, but have them run independently

My quality engineers have asked me to create a report based on a document that they fill out manually. At first glance, it appeared to be an easy enough request. It has been anything but easy. This report shows the results of two inspections and I have a parameter where the user selects one inspection or the other. As it stands now, this report runs just fine when selecting one inspection, but I am anticipating a request to be able to run the reports for both inspections at the same time. And, that's where I run into trouble.
The problem is that I have a text box in the header that is referencing a value from a table in the report that identifies the inspection. When I set the parameter to a multi-value parameter and select all, the report only displays one of the inspections across the entire report. Is it possible to have the user select both inspections but have the report run them separately? I have one dataset for the table and a column in that table that identifies the inspection. I have tried the multi-value parameter and I have tried using the filter option in the dataset properties, but I get the same result.
The easiest way to do this might be to create a new master report and use your current report as a sub-report. It's fairly simple.
Here's the basic steps...
Make a copy of your current report and rename it (say sub_InspectionReport)
Change this report so the the inspection parameter is NOT multi-valued
Create a new report and add your parameter(s) the same as you setup for your original report, This time make sure your Inspection parameter (e.g. pInspection) IS multi-valued.
Create a dataset (dsInspectionIDs) that returns a list of the selected inspection values from the pInspection parameter. The query could be something simple like
SELECT InspectionID FROM myInspectionTable WHERE InpectionID IN (#pInspection)
Note: #pInspection is the name of your report parameter, it is case sensitive.
Now add a table to the report and, as a simple, test, se the dataset of the table to your daatset dsInspectionIDs. Set the first column to show the only available field (in this example InspectionID).
Run the report and test the output using different inspection parameter selections. The table should match what you have selected...
We're almost there...
Now in one of the table cells (but not in the header) , right-click and select "Insert / Subreport". Now right-click the sub-report placeholder and set the sub report to be the copy of the original report we made at the start (sub_InspectionReport in this example). Now, still in the sub-report properties, go to the parameters tab and set the Inspection parameter to the the InspectionID field.
Now when you run the report, you will get your sub-report run once for each selected parameter value with that parameter passed to the sub-report.
Hope that makes sense, I'm not near my PC so I can't provide a sample with images at the moment.

SSRS 2012 nullable hidden parameter

I have a report that pulls data from an xml datasource, populates a parameter with a value, then uses this in the next dataset.
The problem I have is that, despite VS allowing me to set the parameter as nullable, SSRS report manager will not. There is no checkbox.
When running the report I get
The parameter is missing as value
This occurs when there is no value returned by the xml dataset, resulting in a null (valid for the report).
I have tried creating a second parameter, then basing this off the first
Param2 = iif(isnothing(Parameters!Param1.Value,0,Parameters!Param1.Value)
This works fine in VS, but not once deployed to SSRS
Any thoughts, wise people?

Crystal Reports parameter sending NULL instead of chosen value

I have a CR 2008 report reading from SQL Server 2008 R2 that used to contain 3 parameters and worked like a champ. The business requested the addition of a fourth parameter. I added the variable to the stored procedure, tested and got the results I was looking for. I then created the parameter as a static list of values as we do not need all values available. I went to the record select expert and lined up my parameter with the appropriate database field. Ran the report, got an error on an incorrect amount of parameters. Refreshed the database; the report ran but returned no results. Checked my parameter values against the stored procedure. Once again, the stored procedure returned results. Went back to Crystal and viewed the query. Lo and behold, the query is sending in NULL for the new parameter even though a specific value was chosen on the prompt. I even went so far as view a tutorial on adding parameters to be sure I did it correctly. Anyone have any thoughts on why the parameter isn't being read properly?
I think you need to right click on Database fields from Field Explorer > Database expert > see this picture
that will surely work coz sometimes crystal reports stored procedure need to be reset or refresh to reflect any changes on the SQl code

SSRS Drop Down List Values

We have a report in SSRS that has drop down list parameters that are fed by a shared datasource and query.
If I use ReportViewer to view the report these work as expected.
However, I'm also using the SSRS web service to pull out the parameters and the available values. In this instance when drop downs are moved from a manually entered list to a query the available values list is empty.
I'm assuming the problem is because the web services simply gropes the RDL file and does not execute the queries attached to the parameters.
My question is, is there any way to have it do this or to get the available values?
After reading MSDN it seems the answer is to call GetReportParameters() and set ForRendering to true:
If ForRendering has a value of false, the parameter meta data returned represents the parameter data that is currently associated with the specified report. If any parameters values are based on a query and you are interested in returning the query-based parameters valid values list, you need to set ForRendering to true, In addition, for query based parameters, you need to ensure that you have passed in all of the credential information required to return the query parameters.

Crystal Reports using multiple results from a Stored Procedure

I have a stored proc in sql-server and one of the parameters it returns is a string with the query parameters. I display those query parameters at the top of the report. That works great if something is found, not so great if nothing was found.
We have tried returning two query results, one the data set that I will make the report from (which includes the query parameters), the other the query parameter string. Crystal appears to only see the first data set, and this very old discussion (http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=42462) says that is not something that will work. But that was over 5 years ago, and I'm hoping things have changed.
The problem, is if nothing is returned, the report is so blank that the person doesn't even know what query parameters they used. If they could see that they queried something that doesn't return any results, that would be useful.
So, if I have at the end of my stored proc:
SELECT * FROM [#ResultSet]
select #SearchCriteria as SearchCriteria
I'd like to be able to display the SearchCriteria even if there is nothing in the #ResultSet. Can it be done with this version of Crystal? Is there another way to do this?
Unless as stated by the first answer the results of one procedure have the same number of columns of another procedure (this includes type), if this is the case you can UNION the results or UNION ALL the results (if you want duplicates) to get ONE resultant set.
If the types or columns are not the same then you cannot do this. The only other option you can do is to merge all the relevant data into a temp table and then return the results from that temp table (SELECT * FROM #temp)
How are you currently able to display the parameters when results are found?
You haven't mentioned how you are using the Crystal Report in your environment.
Typically, I've done criteria display by passing the parameters to the Crystal Report as Report Parameters, and then using them in fields. This assumes you are calling it from a client application in some way.
Another option is to load the results into client datatables and binding to that as a datasource, it's certainly possible to handle the multiple result sets that way.

Resources