Skip to content

Server-side variables

Many server-side variables are available in text nodes.

Processing order:

  1. System variables are set from the request.
  2. srssetup runs. Its parameters can already use system variables.
  3. Every column of the first srssetup row becomes a user variable.
  4. Variables are replaced in parameters, description, columns, options and commands.

System variables

kv.v.* variables are set only for authenticated users.

  • [[kv.v.user.username]] - username
  • [[kv.v.user.userid]] - user ID
  • [[kv.v.user.currency]] - currency
  • [[kv.v.user.teamid]] - team ID
  • [[kv.v.user.app_name]] - user's current application name
  • [[kv.v.api.version]] - API version
  • [[app_name]] - application name
  • [[apimethod]] - GET/POST
  • [[apipath]] - for example {{host}}/api/srs/xtet?param=param
  • [[userpermission]] - comma-separated list of permissions
  • [[basepath]] - for example http://test.com
  • [[srs_name]] - SRS name
  • [[srs_id]] - SRS ID
  • [[session_id]] - SQL Server UUID, database-friendly
  • [[ipv4]] - IPv4 address
  • [[trace_identifier]] - trace correlation identifier
  • [[user_agent]] - user agent
  • [[ismobile]] - detects whether the request comes from a mobile device (Android, webOS, iPhone, iPad, iPod, okhttp, BlackBerry, IEMobile, Opera Mini)
  • [[tenant]] - hosting_tenant from settings

User variables (defined in srssetup)

Example:

XML
<itm model="command"  name="srssetup"  opts="server">select getdate() currentdate</itm>
  • [[currentdate]] - current date

A srssetup column must not have the same name as a system variable, and two srssetup commands must not return the same column name.

SRS and variables

Server-side and user variables can be used in the SRS:

  • srs/description - description
  • param
    • srs/def/itm[@model='param'] - value; an unresolved variable equals null
  • option
    • srs/def/itm[@model='option'] - value
  • column (an unresolved variable is replaced with an empty string)
    • srs/def/itm[@model='column'] - value
    • srs/def/itm[@model='column']/@label
    • srs/def/itm[@model='column']/@opts (also visibility, by setting lg-true, lg-false, sm-true, sm-false)
    • srs/def/itm[@model='column']/@css
  • command (an unresolved variable is replaced with an empty string)
    • srs/def/itm[@model='command']/@label
    • srs/def/itm[@model='command']/@type
    • srs/def/itm[@model='command']/@opts (also visibility, by setting lg-true, lg-false, sm-true, sm-false, active-true, active-false)
    • srs/def/itm[@model='command']/@css