Changes

Using Variables in the Report Builder

1,850 bytes added, 20:41, 11 March 2008
no edit summary
When creating a report there are two variables that can be used as [[Parameters|parameters]] to the report, which will restrict its results - the '''@companyid@''' and '''@userid@''' variables.

Within the report use either of theses variables:

* '''@userid@''' - returns records where the value of the field contains the [[User|user]] id of the '''person running the report'''. Syntax: '''=@userid@'''
This variable can be used to create an individual [[User|user]]-specific report, such as a sales for that [[User|user]], or login history for that [[User|user]].
* '''@companyid@''' - returns records where the value of the fields contains the company id of the [[User|user]] running the report Syntax '''=@companyid@''' Using this variable eliminates the need to create different reports for different branches but this technique will not display records in the report related to sub-branches. This technique will not display records for sub-branches of the [[User|user's]] branch.

If you wish to create a report that displays '''both''' the [[User|user's]] branch and '''all sub-branches''' of the [[User|user's]] branch then you need to use the following technique:

* Add the field "'''Branch/Offices - Parent List'''" to the '''Report Builder''' window. This field returns a string containing the list of companyIDs that define the [[Hierarchy|hierarchy]] for the current companyID. This string is delimited by commas.
* Set the criteria for this field to '''like '%,@companyid@,%'''' This criteria will compare the current company ID to the '''Parent''' list and include all company IDs where the current company is referenced as a parent. Note the use of the wildcards "%" and the commas in the criteria string. You should hide the field in the report.

[[Category:Reports]][[Category:Applications]][[Category:System Management]]
4,401
edits