Difference between revisions of "Using Variables in the Report Builder"

From SmartWiki
Jump to: navigation, search
Line 1: Line 1:
When creating a report there are three variables that can be used as [[Parameter|parameters]] to the report:
+
When creating a report, there are three variables that are commonly used as [[Parameter|parameters]]:
 
:* '''@companyid@'''
 
:* '''@companyid@'''
 
:* '''@userid@'''  
 
:* '''@userid@'''  
 
:* '''@objectid@'''
 
:* '''@objectid@'''
 
   
 
   
No other variables are supported.
+
<!-- No other variables are supported.-->
  
 
==userid==
 
==userid==

Revision as of 09:09, 8 May 2013

When creating a report, there are three variables that are commonly used as parameters:

  • @companyid@
  • @userid@
  • @objectid@


userid

  • @userid@ - returns records where the value of the field contains the user id of the person running the report. Syntax: =@userid@

This variable can be used to create an individual user-specific report, such as sales for that user, or login history for that user.

companyid

  • @companyid@ - returns records where the value of the fields contains the company id of the 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's branch.

If you wish to create a report that displays both the user's branch and all sub-branches of the 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 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.

objectid

  • When using any of the ReportProperty Variables (recordcount, exportdata and csvdata) the object ID (opportunityid, eventid, userid, etc) will be passed to the report processor. If the specified report includes the variable: @objectid@, it will be replaced by the object ID of whichever object (Level 1, Level 2, Contact, etc) called the ReportProperty attribute.