Parameter missing a value - reporting-services

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.

Related

SSRS Open sub report with provided parameters

I have a report which has 5 parameters and i want to open another report from this report which has 13 paramaters.
When i try to open this report it says some parameters are missing.
I want to know if it is possible like, if i do not pass parameters then it should ignore these parameters in repport and also in SQL query (all these are multivalue parameter).
I cannot use "allow null values" as these are multivalue parameter.
This is main report
These are parameters in sub report which i want to call
Can someone help me please? or i need to create seperate subreport with exact parameters everytime
There are two common ways of doing this.
Populate parameters with a list default values
In your subreport, taking #service as an example. If you can get a list of services from your database then create a dataset tat gives a list of distinct services, use this as the default value for your parameter. Then when you do not pass anything from the main report, the subreport will use all services.
Set the default parameter value to a fixed constant
The other option is to set the subreport parameters to a default value such as *all and then handle this when it is passed to your subreport's dataset query.
So the dataset query might be something like
SELECT *
FROM myTable
WHERE location in (#location)
AND (service = '*All' OR service IN(#Service)

In SSRS, a Date Time parameter on Preview is not matching the deployed report

In SSRS, a Date Time parameter on Preview is not matching the deployed report. Is this something someone else has encountered? The RDL code is identical. Is it the fact that, sometimes, a local preview is just a simulation of functionality? Is it because the display in preview sometimes uses cached data?
I have a SSRS report that, when I preview it in Visual Studio locally, the date shows as 2/10/2019 but when the RDL code is deployed on the server, the date shows as 2/7/2019.
The date time variable is based on a parameter on the report, called rundate, and it has a Default Value of 2/10/2019.
So I think the same thing should happen on the Report Server that happens locally in preview mode.
The report has four datasets and, as a test, I have set each four to have the SQL line that sets the rundate value like so:
SET #rundate = '2019-02-10'
but on the report server, when I load the report, it throws this error:
Must declare the scalar variable "#rundate". Must declare the scalar variable "#rundate".
It is in a cascading tabbed error message that looks like this:
An error occurred during client rendering.
An error has occurred during report processing.
Query execution failed for dataset 'ThirdDataset.
Must declare the scalar variable "#rundate". Must declare the scalar variable "#rundate".
So, why does it run locally and not on the server? The "ThirdDataset" is a false name I have given here. The actual name is redacted. But, I have noticed that this would be the first dataset run if they are run alphabetically. So this leads me to the question: why doesn't the report recognize this as a parameter and why does it complain that it is not declared?
============
UPDATE:
I have set the rundate to be part of a data-driven subscription in a report like so:
SELECT convert (date, DATEADD (DAY, -2 , SYSDATETIME())) as rundate
Which is two days ago. Since it is 2/11/2019 today, the rundate parameter passed to the SSRS report on the server should be 2/9/2019.
For fun, to test this out, I set the Default Value rundate parameter to be 8/8/2018 in hopes that the data-driven report would set it properly.
In preview mode locally on Visual Studio, a textbox that set to show the [#rundate] Expression shows 8/8/2018 which is what I would expect, but the Datasets are designed to run off this parameter. Since there is nothing that the sql should retrieve from the database that is that old, the graphs and charts in preview mode should turn up completely empty. Why do they show data?!
Next, let's see what the emailed subscription alert says. It had the date of 2/11/2019 12:00:00 AM. If the data-driven subscription ran like it shouold ahve run, it should of had the date of 2/9/2019 from
SELECT convert (date, DATEADD (DAY, -2 , SYSDATETIME())) as rundate
Why did this not work?
On the SSRS server, the RDL file has a parameter default value of 2/11/2019 12:00:00 AM but why did the report get THIS default value? What am I doing wrong and how can I fix this?
As a test, I set this default date/time parameter to 12:12:34 for its time to see what would happen. It reveiled that, yes, this is the date time stamp that is being sent to the report. So I unchecked the "Has Default" box
Then, I noticed in the Step 5 of the data-driven subscription I could not advance to Next > without making a small change:
So, what should happen? Will it show the wacky 8/8/2018 value? Will it show the date from two days ago?
Default values for report parameters are deployed only once to the report server, and then they keep their default value after subsequent deployments. This is so that default parameter values used in development don't overwrite the desired parameter defaults on the production server.
So it looks like when the report was first deployed, #rundate had the default value 2/7/2019 but has since been changed on the local report to 2/10/2019. Go into your report server, find the report and go into the Report Parameters section to edit the parameters and change the default value to what you want it to be (deleting the report from the report server and re-deploying it with the updated parameter will have the same effect, but note that the parameter will maintain that default value going forwards). Alternatively, set the report parameter using an expression so that it is continually up to date.
Regarding updating your parameter value in the Sql statement using the SET statement, you can't actually do it that way - you need to set it in the report's parameter list so that SSRS can set the parameter value. Consequently, your databse server is complaining that you are trying to set the value of a local variable that hasn't been defined in your Sql statement, and thus throws an error message.
So you need to set up the Report Parameters in the report parameters section in the report designer. Your Sql can then reference your parameters like so:
SELECT * FROM MyTable WHERE SomeDate >= #rundate
The parameters normally get mapped into your dataset automatically but you might want to check this by going into the Parameters settings on your dataset to make sure. If the parameter doesn't exist there, set it up.
After lengthy trial and error, I found that the answer was to NOT have the parameter set to have a default value on the SSRS Report Server.

SSRS 2008 won't let me override User!UserID with a data driven subscription

I have one SSRS report with two linked reports pointing at it.
One is for users to click and view their data. Behind the scenes, I need it to pass User!UserID as a parameter and hide it.
On the other report, I need to set up a data driven subscription that passes the UserID as a value from the database.
If I publish the report with the parameter defaulted to a value of User!UserID, it will not let me save the subscription and gives an error of
"The '/Admin/Subscriptions/Recruiting Sign Ups' report or shared dataset has user profile dependencies and cannot be run unattended. (rsHasUserProfileDependencies) Get Online Help"
If I remove the default value from the report definition, the subscription works but I cannot get the other linked report to pass UserID as a hidden parameter using the Parameters tab on the SSRS interface (rather than in the RDL definition).
Is there a workaround to this that does not involve VB?
So to rephrase you have report A which you use as a subreport in reports B and C. to be able to make a subsciption to report A you need to remove the default value for the user parameter. the user parameter in report A is hidden and with a default value because you don't want users to be able to set it to someone else.
so there are two ways to solve the issue: get data driven subscriptions accept a default value, or find a way to pass parameters from reports B and C
pass parameters from report B and C:
the interface won't allow you to set hidden parameters, but it works. just open report A, change the parameter to visible, open report B and C, map the parameter, go back to A, set the parameter to hidden again.
get data driven subscriptions to accept a default value:
SSRS tries to be smart by finding out that the parameter has a default value set, but it shouldn't be too hard to fool. try getting the default value from a dataset which uses a sql username function, or something in this direction..

Using column from main dataset as multi-value parameter in subreport

Hi I am using SSRS 2008.
My set up is MainReport with dataset1 and 1 parameter - OrderID. One of the columns in dataset1 is ShippingID.
My other report called - SubReport has 1 multivalue paramter - ShippingID.
I am trying to use ShippingID from Main report as multi-value parameter for Subreport.
I tried different threads here but mostly they are diffrent than my scenario.
How do I go about setting this up, is that even possible?
I have been trying to set it up for whole day but unsuccessfully.
In my scenario one Order can be on multiple shipments.
One of the things I tried is creating new multi-value parameter in MainReport - call it shippingIDs_sub and mapping its default value to dataset1.ShippingID. But when I try to run report I get error "The 'shippingIDs_sub' parameter is missing value" - because my MainReport would sometimes return NULL in ShippingID column.
My scenario is very much similar to this
SSRS passing parameter to subreport
although I sometimes get NULLs in the column used as source for multi-value parameter.
Is there any way to filter out NULLs and run subreport only for existing IDs?
In the Action where you call the sub-report, where you map to shippingIDs_sub, use an expression to pass some valid value whenever the value in your dataset is NULL.
=IIF(IsNothing(Fields!ShippingID.value),"Some Valid Value",Fields!ShippingID.value)
As to this:
Is there any way to filter out NULLs and run subreport only for
existing IDs?
No, you can't turn off the ability to go to a subreport, but you can "hide" it by changing the appearance of whatever your user clicks on so that it doesn't look like it's clickable. For example, in our reports, when something is clickable, we make it underlined in blue. So if I don't want to user to click it, I just make it the same font color/style as all the other text. But it doesn't stop a determined user from clicking on it anyway if they want.

Getting a "one or more parameters required to run the report have not been specified" error

I am building a report that I would like to accept two values from the user, feed those into a query, and find the data associated with those entries.
For example, if you had a list of employees, performance measures, and values associated with those; then the user would select an employee name / performance measure, and they would get the scoring information on that employee for that measure.
I have two parameters, each being populated from SQL queries getting a distinct list of employee names and measures, and a table below that just pulls up information based on ~ 'WHERE name = #Name AND measure = #Measure' but when I click 'Preview' to run the report locally I get the error: "one or more parameters required to run the report have not been specified"
I know the parameters are working properly because I can feed their values directly into a textbox and the values populate correctly. Also, if I change the query to just accept one parameter (i.e. WHERE measure = #Measure) the query works.
I'm confused as to why this error is occurring since I know my parameters are functioning and being populated properly.
I experienced this behavior in .NET 4.0 using Local Reports (in .rdlc files), when one of the parameter's values was containing an emtpy string. Although setting the parameter was correct:
report.SetParameters(
new List<ReportParameter> {
new ReportParameter("Title", Messages.Title),
new ReportParameter("SubTitle", Messages.Subtitle))
}
);
It worked only as long as both parameters actually contained some characters, otherwise the mentioned exception was thrown.
This error is caused when you either
A) the parameter is spelled wrong in the actual report. Meaning that the query is expecting #Name but the report is passing #Names (or some other spelling).
or
B) Is it possible you are attempting to run the report with a default value on the parameter of NULL for #Name but the stored procedure requires an actual value?
This might be happening if you are building the report in Visual Studio and gave the #Name parameter a default value of (null).
Try removing the default value or making sure you #Name parameter has an actual value, even if it's just ''.
I had similar issue. Issue happened when you use SharedDataSource with parameters that are to have null value. If you use same query in embeded data source, there is no problem.
Unlike embebed data source, you have to define if parameters used in query of shared data sources are allowed to have null value as highlighted in screenshot here. In my case, there are two parameters in query of shared data source, that can have null value.
So after setting them to allow null, problem fixed!
This caused me many hours of pain. Turns out that it's to do with using a shared dataset.
Embed the dataset within your report instead and it works fine.
For me, setting the value of the parameter makes problem. I don't know why, but the parameter value was not able to accept a string.Empty or null. So i just gave a " " as value solves the error.
Sample
ReportParameter[] parameters = new ReportParameter[4];
parameters[0] = new ReportParameter("Name", EName);
parameters[1] = new ReportParameter("ShiftName", CurrentShift);
parameters[2] = new ReportParameter("Date", LoginDate);
if(ValidateReportData())//some condition
{
parameters[3] = new ReportParameter("Date1", LoginDate);
}
else
{
//parameters[3] = new ReportParameter("Date1", string.Empty);//this makes exception while calling Render function.
parameters[3] = new ReportParameter("Date1", " ");//Solves the issue.
}
I was having the same problem, it is now sorted on sql server 2008 r2.
I know this is now an old question,
but just to help others:
It was very simple really, just making sure the spelling including the case is the same and the use of #.
I have a shared dataset called currentSpaceByDrive with the following code:
SELECT
[DRIVE]
,[Volume_Size_GB]
,[VolumeSpaceAvailable_GB]
,[VolumePercentAvailable]
FROM monitoring.dbo.currentSpaceByDrive(#ServerID)
I add the shared dataset currentSpaceByDrive to my report and I give it the same name.
when I right click on it, the one on my report, dataset properties, the parameter is #ServerID.
#ServerID value comes from another dataset, called the_servers (where the user selects a serverID)
I have a report parameter also called #ServerID that gets its value from the_servers and is used to feed the #ServerID parameter on currentSpaceByDrive.
Too many #ServerID, I understand, but if you do your own test based on this, you will get it done.
See the image attached.
hope this helps
marcelo
check DataSet In Report Server , I had Similar Problem , I was Editing Shared Dataset in Visual Studio , but it didn't work , after an hour of frustration I checked dataset in report server and I found out it Is not updating with changes I made in visual studio , I Delete it and Redeploy Dataset Again from visual studio . it works .
Actually I had to:
Delete the SubReport object from the report.
Drag new object from Toolbox
Setup the SubReport name and report
In Paramateres "Add", and choose each parameter, and related value.
Then is works for me.
I think I have same issue my Parameter Supervisor is blank when I choose "Select All" which causes the error "One or more parameters were not specified for the subreport", but if I select a few supervisor name then the sub-report appears. It is puzzling because the Manager parameter value shows all value when "Select All" is checked, but it is not working on my Supervisor parameter. Note that Supervisor parameter is dependent on manager parameter.
I'm using shared DataSets for several reports, and the root cause of this issue was not mapping the input parameters from the report itself to the parameters of the shared dataset.
To fix, I navigated to the "Report Data" panel, opened the dataset (which is really linking to a shared dataset), clicked the "Parameter" tab, and then mapped the report parameters to the parameters of the shared dataset.