I've created a snapshot of my report in order to improve the performance. However, it appears that it's only using the snapshot on the default values for the report. If I change the values, it appears that it's calling the procedure again (?) or rendering the report again.
The report has a dataset which calls a procedure (no input parameters), which can be filtered using the input parameters.
The snapshot has been created using the Snapshot Options and Processing Options. Any ideas what I need to do in order for the report to use the snapshot all the time?
That is basically how snapshots work - they are a point-in-time copy of the report results taken with the default parameter values. If you change the parameters on the report then SSRS will not use the snapshot because the report results could be different.
It sounds like your report is always returning all data from the procedure, which is then filtered at report rendering time based on the parameter values. This is not a good design and is probably the reason for your report performance problems. Try modifying the procedure to accept parameters and passing these from the report - this way the procedure only returns as much data as is necessary to display in the report and the report server does not have to do filtering when rendering the report.
Related
I'm running into an issue with an SSRS subscription report that I built. Basically I have 2 datasets and 1 parameter that gets fed to both of them called #ReportDate.
#ReportDate has a default value =Today(). When the report runs every morning and gets emailed out by the subscription, dataset1 always gets updated information with today's date and works fine, however dataset2 always returns data for the previous date that the report successfully ran. So it's like the parameter isn't feeding the updated value through to that dataset, which is odd because both datasets use the same parameter. When I go to troubleshoot the problem and run the report dataset2 will then come back with data for todays date so I can't replicate the issue. Am I doing something wrong? I'm using SSRS 2008 r2. Thanks for your help.
Edit: Found the problem. Both datasets shared the same datasource which means the datasets run in parallel, not in the order which I see in report builder. Dataset2's data is dependent on a table which get's populated during the execution of dataset1. Dataset2 was finishing before dataset1, thus it wasn't picking up current days data. I updated a setting on the datasource to make it so that the datasets run 1 at a time in the order in which they're shown in report builder. The setting I changed was checking a check box in the datasource properties called "Use single transaction when processing the queries".
Found the problem. Both datasets shared the same datasource which means the datasets run in parallel, not in the order which I see in report builder. Dataset2's data is dependent on a table which get's populated during the execution of dataset1. Dataset2 was finishing before dataset1, thus it wasn't picking up current days data. I updated a setting on the datasource to make it so that the datasets run 1 at a time in the order in which they're shown in report builder. The setting I changed was checking a check box in the datasource properties called "Use single transaction when processing the queries".
Updating DataSource
I am using SSRS (2008R2) to create a large report against an Oracle
database.
Because of the size of the report I wanted to cache the shared
dataset overnight.
The dataset has a single parameter which should default to today's
date but be changeable in the report (although this would trigger
another cache).
I have struggled with this for 3 days and wanted to document how I got it to work, as well as get feedback on my approach.
1. Oracle Datasource:
I found that passing parameters to the dataset only worked well for me using the native Oracle drivers, not the OLE DB drivers.
2. Shared Dataset:
I was never able to get SSRS to pass a date parameter to Oracle. In my Oracle query I therefore used the conversion TO_DATE(:EffectiveDate,'YYYY-MM-DD"T"HH24:MI:SS') (you'll see why I had to use ISO 8601 format later).
When adding the variable :EffectiveDate to my SQL query a parameter was automatically added to by shared dataset. This initially caused the Oracle error ORA-01008: not all variables bound. This was resolved by deleting the dataset parameter and then clicking "refresh fields" on the dataset query screen to re-create it. The only difference apparently being that now the parameter name has a colon.
I have set the dataset parameter up as shown below in the screenshot:
The parameter is of type "text" and defaults to today at midnight in ISO 8601 format (=Format(Today(),"yyyy-MM-dd\T\0\0:\0\0:\0\0"))
3. Report Dataset:
The Report Dataset uses the Shared Dataset above and also has a dataset parameter. In this case I want the report dataset parameter to take a date from a report parameter but pass a string to the shared dataset parameter as below:
The Dataset Parameter is set to the value =Format(Parameters!EffectiveDate.Value,"yyyy-MM-dd\T\0\0:\0\0:\0\0")
4. Report Parameter:
The Report Parameter is set to "date" type as below with a default of =Today():
5. Shared Dataset Caching:
First I set the Shared Dataset to use cached data (on the report server via your browser):
Then I set up a "Cache Refresh Plan":
The Cache Refresh Plan seems very picky about Parameter format and it was this last step that only seems to work if passing dates as ISO 8601 compliant strings.
6. Notes:
:EffectiveDate is the name of my Oracle string bind variable and EffectiveDate is the name of my Report parameter. Change your code appropriately.
I was only interested in the date (i.e. not the time). If you need time as well you may need to make some changes.
In order to let the end user know how old the data was, I added an extra column ,SYSDATE AS DATA_AGE to my SQL Query. I was then able to reference the age of the data in my report header with First(Fields!Report_Date.Value, "<report_dataset_name")
I am able to create snapshots of the report but all of the prompts are greyed out, even though all the other prompts only effect report filtering.
To have different prompt defaults in my snapshots I used the test IsNothing(User!UserID). I'd love to know if there was a better way.
My example isn't necessarily in the order in which I set things up (i.e. I reference the Report Parameter before showing its setup).
I have report where I ask user to write path to dir of files. This parameter have default value on start, but I want to allow user change it. From moment where he change it parameter wrote by user will be displayed as default on next render time.
Edit:
I use Buissnes Inteligence and SQL SERVER 2008r2
I don't think this can be done in SSRS alone.
What you could do would be to write a procedure to produce your report output, which accepts the directory path as a parameter and saves it to a user lookup table, before producing the report data.
You could then use a query on the user table to produce the default value for the parameter in SSRS.
I am currently trying to automate reports using SSRS in SQL Server 2008, requiring little to no user input at all.
I have the queries already to acquire the data, but they require datetime parameters which are retrieved from an invoices table in the database.
Is there any way to automate this, without requiring user input? I'd like to have these reports fire off every Monday morning without prompting. We also have an internal web site which is used for administrative work, written in ASP and C#, that I can use in conjunction in need be.
Regards and thanks
You should be able to do this. In each report you can set a query to retrieve parameter values and you can also specify a query for the default values.
So
Add a parameter and have that parameter be passed to your stored proc that gets your data
Set the available and default values for that parameter to a sql query that returns the value you need for the parameter.
You'll need to do this for each parameter. Then as long as all parameters in the report have default values the report will run without prompting for parameters.
I am using SSRS 2008.
I have a multivalue, text, not blank parameter named personID. This parameter's available values are set to a dataset (let's call this dataset PersonQuery), which is tied to a stored procedure. This parameter's default values are also set to PersonQuery. This was working perfectly where when the page/report loaded all possible values for personID were selected.... then I must have changed something (however, I don't remember changing anything..?) because now it is broken... Everything is still fine locally but not once it's on the server.
When I first noticed it was broken only one of the available values was selected. So, I decided to try putting ltrim(rtrim(value)) in my stored procedure without changing any names or aliases.... and updated/refreshed the fields in the dataset to be safe and re-deployed the report to the server. Now, no default values are selected for this parameter when the page loads.
Can anyone suggest anything to try or has any idea about what's going on here??
A quick fix might be to delete the server version of the report and redeploy/upload your .rdl as a new report. SSRS keeps some of the meta-data about reports when a new definition is uploaded to replace an existing report. This includes some attributes of the parameters. This metadata is removed when a report is deleted from the server.
If you delete the server version of the report, you will lose subscriptions, and may need to reconnect the datasource, but if the report is working locally, then I think this will fix the problem.