I had a requirement to add a disclaimer message to a report that the user needs to agree to before they can see the report.
My initial idea was to simply add it as a parameter, but the message was quite long and it looked terrible, so this is the solution I came up with.
Simply Put
I have 2 controls, one with the disclaimer, the other a data table. When the user clicks Agree in the disclaimer the action reloads the same report but passes in a parameter. I use that parameter to show/hide the 2 controls.
Like I said, the easy way.
Creating it on a report
Step 1 – Organise the components
To make it easy, if there are many things you need to hide, put them all in a rectangle, that way you can just show/hide the rectangle.
Step 2 – Add the Parameter
Add a hidden Boolean Parameter to the report called DisclaimerAccepted with a default value of false.
Step 3 – Add the Disclaimer
Add the disclaimer inside a rectangle called recDisclaimer.
Add the expression [@DisclaimerAccepted]
to the visible property of the rectangle. This will hide the rectangle when DisclaimerAccepted = true.
Step 4 – Add the Agree and Disagree items
On the Agree textbox add the following Action
Similar to the Agree, add a textbox for Disagree with an Action similar to Agree, but the DisclaimerAccepted should equal false. This will pretty much do nothing.
Step 5 – Set the Visibility on the report detail
Whether you put everything in a rectangle in step one or you only have a table, set the Visibility on that object to…
=Not Parameters!DisclaimerAccepted.Value
What it looks like
This is what my report looks like in design
This is what it looks like when it is been run
The user has entered search criteria and pressed View Report
- The user does have to run the report for the disclaimer to show because the parameter is required. If the parameter was not required, or there was no parameter, the disclaimer would show.
After Clicking Agree
- Notice that the parameter that was entered has been carried across, that is, no need to be entered twice.