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]] teamid
  • [[kv.v.user.app_name]] user's current application name
  • [[kv.v.api.version]] version
  • [[app_name]]
  • [[apimethod]] - GET/POST
  • [[apipath]] - example {{host}}/api/srs/xtet?param=param
  • [[userpermission]] - comma-separated list of permissions
  • [[basepath]] - 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
  • [[user_agent]] - user agent
  • [[ismobile]] - detect if request is from mobile 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 SRS

  • srs/description Description
  • param
    • srs/def/itm[@model='param'] value; an unresolved variable equals null
  • options
    • 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
  • commands (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 visiblity by setting lg-true, lg-false, sm-true,sm-false,active-true,active-false)
    • srs/def/itm[@model='command']/@css