SSRS Parameter using a stored procedure with a parameter - reporting-services

I have a SSRS report that pulls data using a stored procedure. Two of the parameters on this report have default values stored (i.e. Role:Student, ID:Guest)
One of the parameters is a dropdown that is filled with a different stored procedure using the two parameters mentioned above. When I set the parameters for this new dataset to #Role and #ID, I get a rsInvalidReportParameterDependancy error. I have changed the order of the two parameters with no success. Any thoughts on how to resolve this?

It sounds like you have three parameters but you have only mentioned changing the order of two. In my head, I would think that Role and ID must come first in your list of Parameters. I'd start by sorting those to the top. Then you should be able to add in your third parameter, populated by the result of those two. Can you provide any more information of what you've tried or what doesn't work?

The answer to this question has been posted before. However, I did not realize that I had the same issue. The answer has to do with the parameters not being in the correct order. For instance, I had 6 parameters on the main report. Parameters 5 and 6 were hidden to the user. Parameter 3 contained a dropdown that was populated by a stored procedure that needed #Param5 and 6. Even though parameters 5 and 6 had default values, it would not work until I moved param5 and 6 before param3.
I changed the order of the parameters on the report's main stored procedure and then change the parameters order in the report. (I ended up doing this using a text editor.)
#param1
#param2
#param3
#param4
#param5
#param6

Related

Using a parameter as a filter - Multiple values not working

The report works for just 1 choice, but when I add more than one, it does not return anything ( no errors, just nothing in the report).
My SQL statement includes the parameter #Region
where Region_Name IN (#Region)
In the Region parameter's properties, I set to allow multiple values.
in the dataset filter's properties:
Expression: =Fields!Region.Value
Operator: IN
Value: =Parameters!Region.Value(0)
*EDIT
I removed the dataset filter as suggested.
Below are the properties for the parameter.
The available values come from another data set that is a distinct list of regions.
Your edit makes a lot more sense. To use multivalue parameters you just need to reference the parameter in the usual way, except use in within the SQL:
select cols
from table
where specificcol in #Region
And then don't have a dataset filter set, just make sure there is a reference to the Region parameter in the Parameters property page. The filtering of the data is handled by the inclusion of the parameter in the SQL, so you don't need to also have a filter on the SSRS dataset.
Instead of using a parameter to go back and forth between the stored procedure and the report, I created the parameter and used it in the tablix properties.
Expression: =Fields!Region.Value
Operator: IN
Value: =Parameters!Region.Value
When you first create the value, it adds a (0) to the end of the expression. Remove that and it works as expected.
Thank you #iamdave for the help!
EDIT:
I came back to this and was able to filter using the parameter and stored procedure.
I followed a link from a question to here: http://www.codeulike.com/2012/03/ssrs-multi-value-parameters-with-less.html
I created a dataset parameter and removed the one from the tablix properties. Then created the function provided and it worked. I did not mess with the "ALL" features in the post.
Thanks for all the tips. Brent

SSRS Sub-Report not displaying in production

Some days I just really hate M$.
I have an SSRS Report, the dataset is being populated by a stored procedure. Report display the results one district (grouped rows) per page. Stored procedure is returning aggregated counts. So far so good.
I've added two sub reports to the tablix, one in the left column, one in the right. Almost exactly the same. I've clicked on the cell, clicked insert, and selected SUB-REPORT. Then I click on the new SUB-REPORT, and use the drop down to specify which report to use as a sub-report.
They too have a data set being fed by a stored procedure, which may return from 0 to several rows. Both sub-reports use exactly the same parameters, with the same names.
---------------------------------------------------
|___________________DISTRICT 12___________________|
|_____________Item 1|__75|____________Item 2 |__42|
|_____________Item 3|__15|____________Item 4 |__45|
|_____________Item 5|___5|____________Item 6 |__16|
|_____________Item 7|__65|____________Item 8 |___0|
|_____________Item 9|__12|___________Item 10 |__55|
|=================================================|
|______Sub Report 1______|______Sub Report 2______|
|_________category 1|__27|_________category A|__16|
|_________category 2|__15|_________category B|__42|
|_________category 3|___2|_________category C|__60|
|_________category 4|___6| |
|_________category 5|__16| |
---------------------------------------------------
It looks and works fine in Visual Studio. Each sub report works fine on it's own, and works fine within the main report as well. But when I deploy all 3 reports, sub report 1 says "Error: Subreport could not be shown."
Sub-reports take exactly the same parameters. Sub reports get district ID, year, etc to pull data.
I've recreated the offending sub-report with another name, replaced it in the main report, with the same result.
I've recreated the main report, giving it both sub-reports, with the exact same result, sub-report 1 and sub-report 1b dos not work, sub-report 2 does.
I compared the sub report files with each other using ExamDiff (shameless plug, excellent tool!) and found no real differences.
I cracked open the main report file with XML Notepad (another useful tool) and found no real differences in the way they are set up.
All reports are stored in the same directory.
I opened the project file, and found nothing of interest there.
I even added the external tool to clear local report cache as suggested elsewhere.
I am stumped. I am certain this has been encountered before. Any pointers?
As always, thank you to my compatriots on Stack Overflow. Best source of advice for developers on the planet.
This could be the old FMTONLY and SSRS problem.
For more details please see these links
http://www.sqlservercentral.com/articles/Reporting+Services+(SSRS)/119024/
No fields for dynamic SQL stored procedure in SSRS with SET FMTONLY
I use this in some of my old SSRS stored procedures when the resultsets do not get displayed initially
CREATE PROCEDURE report1 AS
BEGIN
DECLARE #FMTONLY BIT;
IF 1 = 0
BEGIN
SET #FMTONLY = 1;
SET FMTONLY OFF;
END
-- Stored proc main code here
IF #FMTONLY = 1
BEGIN
SET FMTONLY ON;
END
END -- End of stored proc / RETURN
Seriously, sometimes I hate M$.
The stored procedures for the two sub reports only bring back 4 fields, one I don't even use (district ID). The report only has three text boxes in a table, one is just a literal. The other two are
=Description + " (" + code + ")"
and
=DistCounts
ABSOLUTELY NOTHING TO THESE.
Finally we took the one that worked, copied the XML to an new sub report, changed the dataset, field names and literal, redeployed, and it works. Comparing the one that works with the 2 that didn't ... shows nothing of interest. Arrrrgh!
As I said, both used the same input parameters, the stored procedures were just counting different fields. Wasted more than a day on a wild goose chase, and we still don't know what was wrong.

Report Builder 3.0 Forward Dependency Report Parameter

I have a report that I am working on that will do the following:
Return results based first on the community selected by the user.
Filter to find alike addresses within the community, based on the number of square feet at each address.
Set the end date (a column within the data table) to a user defined parameter for use in a WHERE at the end of the query.
The relevant information is stored in the following places:
Community: ub_subdivision.descr
Address: ub_serv_loc_addr.location_addr
SqFt: arp_ops.dbo.vw_ub_serv_loc_classifications.SqFt
I have setup the query with 3 parameters:
#Community
#Months
#Address
When the user is running the report, the following should happen (in this order):
The community parameter should populate the values stored in ub_subdivision.descr and allow the user to select the community they want from that list.
The address parameter should populate the values within the selected community from step 1, and allow the user to select the address they want from that list.
Based on the selected address, the query should store the value of the SqFt related to this address and use that in the WHERE statement as follows: WHERE (arp_ops.dbo.vw_ub_serv_loc_classifications.SqFt = #Address)
The months parameter should allow for user input to define how many months of data they want. This parameter is called in the query in the WHERE statement: WHERE (ub_bill_run.def_end_dt > DATEADD(m, -#Months, GETDATE())).
If I save the dataset and create a "table report" in Report Builder 3.0 it does the job of recognizing the various parameters and loading them into the Parameters folder and into the Datasets' parameters.
The problem I have is that I am not able to change the parameter properties to display Available Values and select "get from a query". If I go this route, and try to run the query I get an error that I am using "forward dependencies".
I need the #Address parameter to display the address field as the label, but store the sqft field as the value. This is the way I know how to do this and, unfortunately, it doesn't seem to work.
I would appreciate any insight anyone may have.
Thanks!
John
There is one way to solve this make sure the order should be in the order of
#Community
#Months
#Address
change order to:
#Community
#Address
#Months
just delete existing #month and again add it manually and save it.
i hope it will work for you.
You cannot have parameters based on your main data set.
The forward dependency error is caused because your data set is to be filtered by your parameter, yet it is depending on the same data set to find its' set of values. This is a sort of paradox.
When using queries to define the set of values for your parameters, make sure you create a new data set for each parameter.
Next, make sure the parameters are listed in the order you want them to run. Within the data sets for your parameters, you may use where clauses to make them dependent on one another in the order that they run.
In this example:
Parameter data set for Community:
SELECT DISTINCT ub_subdivision.descr
FROM [YOUR JOINED TABLES]
Parameter data set for addresses:
SELECT DISTINCT ub_serv_loc_addr.location_addr
FROM [YOUR JOINED TABLES]
WHERE ub_subdivision.descr IN (#Community)
Parameter data set for SqFt:
SELECT DISTINCT SqFt
FROM [YOUR JOINED TABLES]
WHERE ub_subdivision.descr IN (#Community)
AND ub_serv_loc_addr.location_addr IN (#Address)
You should also make a month data set for your #month parameter, however it is not dependent on the other parameters so I will leave that to you.
Hope this helps!

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.

Parameter missing a value

I am new to reporting services and have a reporting services 2005 report that I am working on to use as a base report template for our organization. I am trying to place the date that the report was last modified on the report server into the page header of the report. However, I keep getting a 'ParamX' parameter is missing a value error when I try to This is what I have done:
Set up a Parameter ReportName with a default value of Globals!ReportName. It is also hidden and internal.
Set up a Dataset ReportHeader that calls a stored procedure that returns the date the report was last updated or another date, if the report is not on the report server. It has a parameter #ReportName assigned to the Parameter!ReportName.Value. The Dataset returns values when run on the dataset tab in the BI tool.
Set up a Parameter ReportVersion that has a default value Query From based on the dataset ReportHeader and picking the ModDate column. It is the last parameter in the report parameters list.
I assign a textbox to the parameter.
When I preview, I get "The 'ReportVersion' parameter is missing a value whether I place it in the report body or page header (which is where I want it). I have deleted and added the parameter again, toyed with the hidden and internal settings on it.
What does this error really mean, what I am missing, and can I even do this with parameters?
Thanks In Advance
Jim
If I understand what you're doing, it sounds like you want to be using a field where you're implementing a parameter...
You are returning the ModDate from the data source, correct? If you're doing this, you can simply throw a text box in there, and use something like this: =Fields!modDate.Value to display it.
Parameters are values that go in to the query, fields are what it returns.
Hope this helps...
EDIT:: OK so are you trying to retrieve the mod-date column value from the reportserver db? If that's what we're talking about, you'll need to add a few things to the report. Add a datasource to report db, a dataset containing the date (query below), a list object in the report linked to the dataset, and a textbox in said list object to display the field. If you hit the report server with a query like this:
SELECT MAX(ModifiedDate) AS ModDate FROM catalog WHERE name='myReportName'
That will return your modifieddate from the ReportSErvices Database as a field that you can use.