8,849
edits
Changes
no edit summary
==userid==
* '''@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 sales for that [[User|user]], or login history for that [[User|user]].
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.
Sample use case can be if you are prompting for a date range in the report, but within another column of the report you want to use the user entered date to further limit the records using date_add, date_sub.
==See Also==
* [[Determining the companyid]]
* [[Determining the userid]]
* [[Using Data from a Report as Criteria for Another Report]]
[[Category:Reports]][[Category:Variables]]