Skip to content

Commit

Permalink
Migrated rule
Browse files Browse the repository at this point in the history
  • Loading branch information
jeoffreyfischer committed Dec 15, 2023
1 parent cbb7bf4 commit a5a9cdc
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ index:
- check-out-built-in-samples
- two-migration-options-to-show-acccess-reports-on-web
- print-and-display-report-on-web
- include-useful-footer

---

Expand Down
Binary file added rules/include-useful-footer/RSRulesBadFooter.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rules/include-useful-footer/RSRulesGoodFooter.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added rules/include-useful-footer/footerInDesigner.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 80 additions & 0 deletions rules/include-useful-footer/rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
type: rule
archivedreason:
title: Do you include a useful footer at the bottom of your reports?
guid: 610d52ed-0d2f-459f-a7cc-daff1a00368d
uri: include-useful-footer
created: 2023-12-11T13:38:33.0000000Z
authors:
- title: Jeoffrey Fischer
url: https://ssw.com.au/people/jeoffrey-fischer
related:
- customization-do-you-know-which-version-of-sql-reporting-services-and-visual-studio-you-are-using
redirects: []

---

<!--endintro-->

You should always include a useful and informative footer at the bottom of your reports. Include:

1. Date and Time Printed and User who printed it - see warning below (e.g. Printed by SSW2000\JatinValabjee on 3/1/2006 3:16:30 PM)

2. Execution Time (e.g. Execution time: 1 minute, 10 seconds)

3. Page x of y (e.g. Page 3 of 10)

4. Link to company website + slogan (e.g. www.ssw.com.au This opens in a New Window - Writing software people understand)

::: bad
![Figure: Bad example - This footer doesn't provide any useful information]RSRulesBadFooter.gif)
:::

::: good
![Figure: Good example - Useful and informative information should be displayed in your report footer](RSRulesGoodFooter.gif)
:::

Use these handy report expressions to show the above information.


| Footer Item | Expression | Sample Output |
|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|
| Date and Time printed / User ID | ="Printed by " + User!UserID + " on " + Globals!ExecutionTime.ToString() | Printed by SSW2000\JatinValabjee on 3/1/2006 3:16:30 PM |
| Execution Time | ="Execution Time: " + IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).TotalSeconds < 1, "0 seconds", ( IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Hours > 0, System.DateTime.Now.Subtract(Globals!ExecutionTime).Hours & " hour(s), ", "") + IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Minutes > 0, System.DateTime.Now.Subtract(Globals!ExecutionTime).Minutes & " minute(s), ", "") + IIf(System.DateTime.Now.Subtract(Globals!ExecutionTime).Seconds > 0, System.DateTime.Now.Subtract(Globals!ExecutionTime).Seconds & " second(s)", "")) ) | Execution time: 1 minute, 10 seconds |
| Page x of y | ="Page " + Globals!PageNumber.ToString() + " of " + Globals!TotalPages.ToString() | Page 3 of 10 |


::: good
![Figure: Good example - Footer in visual studio designer](footerInDesigner.gif)
:::

Tip: Copy and Paste this XML into the <PageFooter> for the recommended footer of all your *.rdl files.

```
<PageFooter>
Paste here
</PageFooter>
```

Warning: Adding the User who printed it stops all data-driven subscriptions
When you try to add the User your data-driven subscriptions will fail with the following error:

'The '/GroupHealth' report has user profile dependencies and cannot be run unattended. (rsHasUserProfileDependencies)'.

A quick workaround is to add a user function to fallback the error to a nice message, like: "SYSTEM",

```
Public Function UserName()
Try
Return Report.User!UserID
Catch
Return "System"
End Try
End Function
```

Use above function to replace your reference to Report.User!UserID will allow the subscription to work correctly.


0 comments on commit a5a9cdc

Please sign in to comment.