564 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Reporting Services - report and group variables
Part one of a three-part series of blogs
If you're not sure when - or whether - you should be using report or group variables in SSRS, read this blog to find out how to speed up your reports and solve other problems.
Have you ever wondered why SSRS (as I'll call SQL Server Reporting Services from now on) includes a tab for Variables?
You can create variables either for a report or for a group.
Me too! So I thought I'd do an in-depth blog on how - and why - you would use variables in Reporting Services (and in the process unearth one of the odder bugs).
I thought I'd start with an explanation of what variables are, which is simply expressions with wider scope than would be the case for a textbox.
To prove this, I've created an example report, which you can download:
The ticks are different at report, group and detail level.
The expression to display the ticks is as follows:
What this does is take the current state of a computer's clock cycle, and extract some digits from it to give an impression of how much time has elapsed. If you look at the figures, you'll see the following:
|Scope of expression||Value of ticks||Calculated|
|Report (appears in report title)||221,463||When the report first loads|
|Group (appears in group footer)||221,744 for visible groups||When each group first loads|
|Detail (6 films are visible)||221,775 and 221, 791||When a page loads|
Versions of Reporting Services from 2008 onwards calculate textbox expressions afresh for every page as it loads, but variables are evaluated once only for the report (and cached in memory). This means that group and report variables can save you a lot of processing time.
Now that we know how variables work, let's look at how you might use them, using one example each for report and group variables.
|Parts of this blog|
25 Aytoun Street