Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
546 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers 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
Search our website
We also send out useful tips in a monthly email newsletter ...
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:
=mid(now.Ticks.ToString,9,6)
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 |
---|
|
Some other pages relevant to the above blogs include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.