Using Sqlserver 2012.
Say I have a SSRS rdl report "P" that calls several subreports "S1", "S2".
Just wondering if it is possible to view (in a logfile etc), the parameters and values that P passes to S1 and S2 during report generation.
I know you can view the parameters and values passed to the parent report P in views like ExecutionLog3, but couldn't find any logging of the subreports' parameters.
A work around will be to display the parameter values in the subreports themselves, but this is not ideal. The reports themselves run ok .. the parameters are wanted for diagnostic purposes.
I would suggest adding the logging process to the start of your main dataset in each subreport, that way it will fire only when the subreport is called.
In other words, the dataset for "S1" might look something like...
INSERT INTO dbo.MyLogTable (SubReportName, Parm1, Parm2, ActionDate)
VALUES ('S1', #p1, #p2, GetDate())
{Your original dataset SQL here}
If you parameters are multi-valued then you may have to do some manipulation first but you get the idea I hope.
You could also improve this by using the ID of the subreport from the report server catalogue in case you ever want to join this back to the execution logs.
Related
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)
I am using SSMS 18.5 (fully patched).
I have a report with three (parameter selections; date which is used to select from a list of available items in the second parameter, which in turn is used to make a selection from the 3rd parameter. This report works! When I call it as a subreport from a master report (using the insert subreport), if there IS data found based on the three (03) parameters I pass it, I get the intended results. If no data is found, I receive the "Error: Subreport cannot be shown." Error. THIS IS OK.
My intent is to call this subreport multiple times with different parameters to list out the different result sets.
My question is how do I condition the subreport call in the master report to not show the error message?
Psuedo code for the visibility option:
(IIF(returned value = error message), true, false)
I have tried this directly in the subreport properties (Visibility). I have tried putting the subreport call in a rectangle and I have tried putting it in a table / matrix.
There is NO "field" to reference or rowcount that I am aware of. SSMS only allows reference to items at the same level or higher and not lower (the subreport).
A specific expression ( IIF() ) with an explanation would be appreciated. I have read numerous articles and tried them all with no results.
Currently have three subreports, one main report.
Main report has two parameters - SELECTDATE and EMP_ID. Main report sends Order_Nbr to all subreports.
All subreports work perfectly when I only select 1 Employee and 1 date, but if I choose multiple values it blows up.
SQL has the column as an INT. I have both parameters in main report and subreport, SELECTDATE is set as Text with Multiple Values, and EMP_ID is set to Integer with Multiple Values. My queries has my date IN (#SELECTDATE) and emp_id IN (#EMP_ID).
It obviously sends the correct information to the subreports because it works, but I would like it to work with more values being passed. Love the current ability to check and uncheck employees and end of month dates, like it currently is set using the IN function in my query.
Make the Parameters on your sub report non-multivalue, remove any 'Available values' set.
Pass the multivalue parameter from you parent report as a string using the join method
=Join(Parameters!Emp_ID,",")
The EMP_ID parameter will be set to a comma delimited list, which is what a multivalue parameter sends to the query
I'm not sure how this works with text queries, but it works with stored procedures.
If the sub report is also used as a stand alone report you will need to add a new parameter to allow the user to send parameter values to #Emp_Id from a parameter the user can set
I guess you have not set the parameter in the sub report as Multi Select. If you have set the parameter in the sub report as multi select, then you could just send the parameter from the main report to the sub report as it is. See more at here
I used the following solution, which works in SSRS2016. This also works with text parameters.
Like suggested above, pass the parameter as a string to the subreport by JOINing the values.
Join(Parameters!EmpID, ",")
In your subreport, accept the parameter as text.
In the SQL of your subreport, use the string_split function of SQL 2016 to return a table of the values and simply join it to your main query. So basically if your parameter is named "EmpID_Multi" do
... JOIN (SELECT value FROM string_split ( #EmpID_Multi, ",")) mv ON mv.value= ...
Note: You might consider pulling the values into a temporary table for SQL optimization (sometimes the optimizer does funny things...).
I'm writing my first SSIS pkg and I'm stuck. Any insight would be greatly appreciated.
I'm running a sql agent job that kicks off a SSRS report. (The job was generated via a scheduled subscription.)
This report relies on 2 stored procs which require the parameter 'When' (date type) and it dumps a PDF of the report to a file share.
My execute sql task runs this: EXEC msdb.dbo.sp_start_job N'myJobName';
How can I pass a value for the parameter 'When' into the report?
Why do you even need SSIS for this? Set up a subscription in SSRS to export the report where you need in the format you need on whatever schedule you want. The Subscriptions in SSRS allow for parameters to be stored with the subscription as well.
I figured out how to accomplish this.
When you define the report in SSRS turn on "Report Data" view. On this view you will find a Folder named Parameters. Expanding this shows a node for each parameter. Right click and view parameter properties.
I solved my problem by selecting default values > Get Values from a query (specify Dataset and field). I set up a new db table named ReportParams.
CREATE TABLE ReportParams ( ParamName varchar(50), ParamVal varchar(50) )
This allowed me to do a
SELECT top(1) ParamVal FROM ReportParams WHERE ParamName = 'myparamname'.
By having my SSIS job inseRt the parameter name and value into this table, I'm able to pass a parameter to the SSRS report's default value.
Okay, it's somewhat kludgy, but it works. If anybody has a cleaner way to get this done, I'd love to hear it.
William - the SSIS job is necessary to fill the database with the data that drives the DataSets that the Report depends on.
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.