Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 28687

Data driven subscription and 'select all' option with multiple value parameter

$
0
0

Hello,

I'm having some issues with a data driven subscription in SSRS 2012.

I have made a salesreport that can be run manually, but should also be run automatically via a data driven subscription. 

When run manually, the user usually wants to get specific customer data and uses a parameter to select one. When run via DDS, the user should get all customers. 

I would like to use just one report, for maintenance purposes, as the report itself is the same (DDS - manual)

It uses a multi value parameter that get's is values from a query. 

This query, in return, uses some other parameter (f.e. week, year)

Report data:

So something like:

Parameter 1 = @year

Parameter 2 = @week

Parameter 3 = @customer

The first dataset defines the available customers from an salesordertable:

SELECT customer,name FROM salestable WHERE year(date) = @year AND week(date) = @week GROUP BY customer,name 


The actual dataset for the report uses a third parameter:

SELECT * FROM salestable WHERE year(date) = @year AND week(date) = @week AND customer IN (@customer)

Where @customer is populated by the first dataset, but based on the same two parameters @year and @week, so you don't get all the customers that have placed a salesorder, but only relevant customers.

Now this works fine when manually running the report, but in data driven subscription the third parameter gives me some problems.

Subscription data

I'm using a simple query to get data for the data driven subscription.

Something like:

SELECT year(getdate() AS year, week(getdate()) AS Week, which would return 2012,51

This I'm passing as the 'database' values for the first two parameters. 

But the third parameter (@customer) is not 'working'. 

Question and attempts:

Since it should select all customers available when run via DDS, I tried making a default value based on the first dataset (this worked when run manually, it automatically selected all customers) 

I did check the 'default' option in the DDS - manage page for the third parameter, but it gives me the error:

This report requires a default or user-defined value for the report parameter 'customer'. To run or subscribe to this report, you must provide a parameter value. (rsReportParameterValueNotSet)

I did see some solutions here pointing to a manual fill of the available values for that parameter, but that does not suit my needs. 

Is there any solution for this, or do I have to use two reports (or a different approach, like allowing a NULL value?)

Any help would be appreciated. 

Thanks in advance,

Peter


Viewing all articles
Browse latest Browse all 28687

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>