Token Reference

A Logi "token" is a place-holder variable that represents a value and is resolved at runtime. They're essential for creating dynamic visualizations and reports and are discussed in depth in this topic.

For information about functions and operators, see Built in Functions and Operators.
For information about special query string parameters, see Query String Parameter Reference.

About Tokens

Tokens act as variables in Logi applications and are the primary means of accessing the values of data, request and session variables, cookies, constants, and more. They're resolved into their values at runtime and inserted into the HTML generated by the Logi engine.

Tokens take this general format:   @<TokenType>.<Identifier>~     and here are some examples:

  • @Data.CustomerID~
  • @Request.StartDate~
  • @Function.UserName~

They must start with the @ symbol and end with the ~ (tilde) symbol, and they're case-sensitive.

    @Data.CustomerID~     does not equal    @Data.customerid~

That bears repeating as developers typically run afoul of these two things: tokens must end with a ~ and they're case-sensitive.

 

Logi Studio includes a "token validator" feature. If you enter an invalid token in an attribute value, Studio will display the "Invalid Token" button shown above. In the example, the ~ (tilde) has been left off of the token. Clicking the button will take you to the invalid token(s) in the definition.

Tokens can be used in many, but not all, element attributes to provide a dynamic value. Here are three examples of tokens in action:
 

1. In the example above, a token is used to provide part of a Label element Caption. At runtime, the real server name will be substituted for the token. The output will look like this:

     My server name is: MyTestServer
 

Tokens are extremely literal and are "data type neutral". For instance, in the above example, even though the server name is a string, there is no need to concatenate the "My server name is:" part of the caption (using + or & symbols) and the token.

2. As mentioned earlier, tokens are case-sensitive. In the example above, a Data token is used to represent the value in the ProductID column of each row of data in the datalayer. The spelling and capitalization of the column name in the token must exactly match that of the column name in the datalayer.


3. In our final example, shown above, a token is used in a Division element's Condition attribute. This attribute controls whether or not the Division, and all its child elements, are displayed: if the attribute evaluates to True, it's shown; if it evaluates to False, the element is hidden. A token can be used in this attribute in a formula that evaluates to True or False. More information is available about this in Conditions.

The example uses a Request-type token, which represents data either POSTed by an HTML form or values from parameters in the query string used to call reports. Therefore, if the URL for this report was:

    http://localhost/helloworld/rdPage.aspx?&rdReport=Default&Mode=1

then the Division element would be shown. These URLs:

    http://localhost/helloworld/rdPage.aspx?&rdReport=Default&Mode=2
    http://localhost/helloworld/rdPage.aspx?&rdReport=Default

would cause the Division element to not be shown. If the Mode parameter in the query string is non-existent, as in the third URL above, then the token is empty and the formula evaluates to False.

When you're comparing a token to a string value, be sure to surround the token and the string in quotation marks, as shown in the second set of attributes above.

Logi Studio also includes an "Intelligent Token Completion" feature that makes it easy to enter tokens in attribute values, thus avoiding spelling and case-related errors.
 

"Nesting" Tokens

Because the token is a placeholder that gets resolved at runtime, it's possible to make token identifiers dynamic. This is done by making part of the token identifier itself a token. Consider this token construction:

    @Request.@Local.VarName~~

Notice that it has two @ signs and two tildes. For clarity in understanding how it's processed, imagine there are parenthesis in there, like this:

    @Request.(@Local.VarName~)~

As you can probably now guess, when the report runs, the "inner token" (inside the parenthesis) is resolved first, then the "outer token", which now includes the literal value of the inner token as its identifier. So, for example, if:

- A Local Data element returns data in a column named VarName, value = "Mode", and
- A Request variable exists named Mode, with a value of "Standard"

Then the token @Request.@Local.VarName~~ would resolve to "Standard".
 

Limitations

Nesting only works with Constant, Data, Local, Request, and Shared tokens, and only one level of nested tokens will be resolved, so this won't work:

    NO: @Request.@Local.@Local.VarName~~~


  You may find that it's possible to nest the token type as well and even insert literal text into the token and make it work, but those combinations are not supported officially and may break from one Info version to the next - proceed down that path at your own risk.

Back to top

Token Types

The following types of tokens are available in Logi reporting products: 
 

Token Type

Description

@Application

Represents values set in the Application object from Application State, set programmatically by another application. Does not work for values set directly in Web.config or web.xml files. These values are for global variables that span all instances of the application.

Format:     @Application.<session param ID>     Example: @Application.LogFileFolder~

@Chart

Represents a data value from the child datalayer of a Chart or Chart Canvas element.

Format:   @Chart.<column name>~     Example:  @Chart.OrderDate~

@Compare

Represents the True or False result of a Compare Filter or SQL Compare Filter evaluation.

Format:   @Compare.<Compare Filter Element ID>~     Example:  @Compare.fltContainsDate~

@Constant

Represents the value of a user-defined constant, as defined in the _Settings definition in the Constant element.

Format:   @Constant.<Name Attribute>~     Example:  @Constant.CompanyName~

@Cookie

Represents the value of a cookie. Cookies can be set in Logi applications using the Save In Cookie attribute of certain Input elements or, in Logi Info, by using the Set Cookie Vars procedure element.

Format:   @Cookie.<Input Element ID>~     Example:  @Cookie.Order~

@Data

Represents the data value from the child datalayer of an element, such as a Data Table, that is not a chart.

Format:   @Data.<Column Name>~     Example:  @Data.CustomerID~

@Date

Represents relative dates for reports and report scheduling (see @Date Tokens list below).

Format:    @Date.<date identifier>~     Example:  @Date.Yesterday~

@FileUpload

Returns information in a procedure task about a file upload process (see @File Upload Tokens, below).

@Function

Represents the value of predefined functions (see @Function Identifiers below).

Format:    @Function.<function name>~     Example:  @Function.DateTime~

@Input

Input parameter variable, used inside external JavaScript files.

Format:    @Input.<value ID>~     Example:  @Input.FileName~

@Local

Represents a data value from the first row of the child datalayer of a Local Data element, see Datalayer Introduction. Local data is accessible anywhere within the report definition. Note that child elements of this datalayer, such as a Calculated Column or Condition Filter, reference the data with @Data tokens.

Format:    @Local.<value ID>~     Example:  @Local.ReportTitle~

@Measure

Represents the value of XOLAP measures; used only in the XOLAP Formula attribute of the XOLAP Calculated Measure element.

Format: @Measure.[<measure name>]~    Example: @Measure.[Sales Amount]~

@Procedure

Represents results of operations by Process task procedures, including datasource interactions, file system and email operations, and associated error messages (see Special Identifiers below).

Format:   @Procedure.<procedure ID>.<value ID>~     Example: @Procedure.GetTaxes.SalesTax~

@Repeat

Represents a data value from the child datalayer of a Repeat Elements element.

Format:    @Repeat.<Column Name>~     Example:  @Repeat.data_type~

@Request

Represents values supplied in a URL's query string and in Link Parameters, and the values of User Input elements POSTed by an HTML form.

Format:    @Request.<request variable name>~     Example:  @Request.EmployeeID~

@Session

Represents the values of the application's Session variables, which are unique for each user session.

Format:     @Session.<session param ID>     Example:   @Session.SessionID~

@Shared

Represents the parameter value passed from a Shared Element Params element.

Format:     @Shared.<shared param ID>     Example:   @Shared.myValue1~

@SingleQuote

A token prefix that provides special processing for other tokens. Prefix a token with @SingleQuote to wrap its values in single quotes. Used primarily to put single quotes around a comma-separated string of values, so they can be used in SQL queries. For example, values before: Red,White,Blue and after: 'Red','White','Blue'. Cannot be used with @Data, @Chart and @Heatmap tokens.

Format:    @SingleQuote.<token type>.<identifier>~     Example:  @SingleQuote.Request.MyElementID~


Back to top

@Function Tokens

The identifiers listed in the table below are used with the @Function token. For example, to return the current date and time, use @Function.DateTime~.
 

Token

Resolves To

@Function.AppPhysicalPath~

The complete physical path of the application's virtual directory on the web server. Example: C:\inetpub\wwwroot\MyLogiApp

@Function.AppCachePath~

The physical path of the application's rdDataCache folder on the web server. Example: C:\inetpub\wwwroot\MyLogiApp\rdDataCache

@Function.AppDownloadPath~

The physical path of the application's rdDownload folder on the web server. Example: C:\inetpub\wwwroot\MyLogiApp\rdDownload

@Function.AppVirtualPath~

The HTTP Request.Path string.

@Function.Browser~

The HTTP Request.Browser string.

@Function.BrowserDecimalChar~

The client browser's decimal character.

@Function.BrowserMajorVersion~

The HTTP Request.Browser.MajorVersion string.

@Function.BrowserMinorVersion~

The HTTP Request.Browser.MinorVersion string.

@Function.BrowserThousandsSeparatorChar~

The client browser's thousand separator character.

@Function.BrowserUserAgent~

The HTTP Request.UserAgent string.

@Function.BrowserVersion~

The HTTP Request.Browser.Version string.

@Function.Date~
Deprecated, use @Date.Today~

The current web server date as a short date string.
E.g.: 05/21/2014

@Function.DateTime~
Deprecated, use @Date.Today~

The current web server date and time as a general date string.
E.g.: 05/21/2014 10:21:37

@Function.ErrorDataLayerID~

When the If Data Error element is processed, provides the element ID of the datalayer that encountered the error.

@Function.FileUpload~

The information in a procedure task about a file upload process.

@Function.FUID~

A Functional Unique Identifier string, a unique 16-byte identifier used in Windows Portable Devices.

@Function.GlobalTheme~
 

Provides the name of the theme, if any, assigned to the application using a Global Style element in the _Settings definition.

@Function.GUID~

A random Globally Unique Identifier string. This function is useful for creating unique filenames.
E.g.: a949f8c9-a83d-46fd-970b-2bfb625bd2ab

@Function.HostAddress~

The IP address of the client (browser) computer.

@Function.InstanceID~

The Instance ID value of a Dashboard Panel, in dashboards that have Multiple Instances set to True.

@Function.LastErrorMessage~

The last error message string for any process task executed in the current session.

@Function.PageCount~

The number of data table pages. Only valid when Interactive Paging or Printable Paging elements are in use.

@Function.PageNumber~

The current data table page number. Only valid when Interactive Paging or Printable Paging elements are in use.

@Function.QueryString~

The entire query string (everything after the "?").

@Function.Referer~

The complete URL of the calling web page.

@Function.RowNumber~

The current data table row number.

@Function.ServerEngineVersion~
 

The Logi Info Server Engine version number. E.g: 12.2.047

@Function.ServerName~

The name of the web server. E.g.: localhost

@Function.ServerOperatingSystem~
 

The web server OS name, either Windows, Unix, or Mac.

@Function.SessionID~

The current web server session ID.

@Function.TimeUtc~

The current web server time, translated to UTC (Greenwich Mean Time) time, in 24-hour format, as hh:mm:ss

@Function.UserCulture~

The browser's primary language string.
E.g.: en-us

@Function.UserID~
@Function.UserName~

The current, logged-in user ID or name, when Logi Security (see Introduction to Logi Security) is in use.

@Function.UserRights~

A comma-delimited list of the current, logged-in user's security rights, when Logi Security (see Introduction to Logi Security) is in use. The token value is not available until the Security element has been processed completely.

@Function.UserRoles~

A comma-delimited list of the current, logged-in user's security roles, when Logi Security (see Introduction to Logi Security) is in use. The token value is not available until the Security element has been processed completely.


Back to top

@Date Tokens

The token identifiers listed in the table below all deal with dates. For example,  @Date.Yesterday~ will provide yesterday's date.

Dates are expressed by default in the yyyy-M-d format, which does not include leading zeros for single-digit day or month values. Examples: April 1st = "2009-4-1", April 25th = "2009-4-25", October 31st = "2009-10-31". 

If needed, you can override this default format by specifying a new format in the Globalization element's Default Input Date Reformat attribute. For more information on globalization, see Internationalization and Localization. The Default Input Date Reformat attribute ensures that dates entered by the user are formatted identically to dates returned from @Date tokens. This is especially useful if you are using the @Date tokens with the Validation.Date element.

The Globalization element can be added in the _Settings definition.

To work with the @Date.FiscalQuarter~ and @Date.FiscalYear~ tokens, use the Globalization element to set the first day of the fiscal year.

@Date.TodayUtc~ returns the UTC (Greenwich Mean Time) date .

The TimePeriodColumn element can also be used to parse specific date parts out of @Date token values. For more information on the TimePeriodColumn, see Send Cell Phone SMS Messages.

These are the Date tokens:
 

@Date.Today~

@Date.ThisWeekStart~

@Date.ThisQuarterStart~

@Date.ThisFiscalQuarterStart~

@Date.TodayUtc~

@Date.ThisWeekEnd~

@Date.ThisQuarterEnd~

@Date.ThisFiscalQuarterEnd~

@Date.Yesterday~

@Date.NextWeekStart~

@Date.NextQuarterStart~

@Date.NextFiscalQuarterStart~

@Date.Tomorrow~

@Date.NextWeekEnd~

@Date.NextQuarterEnd~

@Date.NextFiscalQuarterEnd~

@Date.10DaysAgo~

@Date.LastWeekStart~

@Date.LastQuarterStart~

@Date.LastFiscalQuarterStart~

@Date.30DaysAgo~

@Date.LastWeekEnd~

@Date.LastQuarterEnd~

@Date.LastFiscalQuarterEnd~

@Date.60DaysAgo~

 

 

 

@Date.90DaysAgo~

@Date.ThisMonthStart~

@Date.ThisYearStart~

@Date.ThisFiscalYearStart~

@Date.180DaysAgo~

@Date.ThisMonthEnd~

@Date.ThisYearEnd~

@Date.ThisFiscalYearEnd~

@Date.365DaysAgo~

@Date.NextMonthStart~

@Date.NextYearStart~

@Date.NextFiscalYearStart~

 

@Date.NextMonthEnd~

@DateNextYearEnd~

@Date.NextFiscalYearEnd~

 

@Date.LastMonthStart~

@Date.LastYearStart~

@Date.LastFiscalYearStart~

 

@Date.LastMonthEnd~

@Date.LastYearEnd~

@Date.LastFiscalYearStart~

Back to top

@Procedure Tokens

These tokens are used within Process definition tasks:
 

Token

Resolves To

@Procedure.myProcedureID.ColumnName~

The data returned in the first row for the named column after Procedure.SQL executes. The element's SQL Return Type attribute must be set to FirstRow.

@Procedure.myProcedureID.ErrorMessage~

The last error message string for the procedure with the specified ID.
Usage: @Procedure.MyProcedureID.ErrorMessage~

@Procedure.myProcedureID.ErrorOutput~
 

When using the Procedure.Run Shell Command element, if the element's Error Output Filename attribute has been left blank, this token contains the shell command's or application's error output. If no error has occurred, this token will have no value.

@Procedure.myProcedureID.ExitCode~
 

When using the Procedure.Run Shell Command element, contains the "exit" or "return" code from the shell command or application, often 0 for success.

@Procedure.myProcedureID.MethodName~

The data returned from an external web service after Procedure.Web Service executes. The Web Service Method element used in the procedure must have its Return Type attribute set to String.

@Procedure.myProcedureID.rdReturnValue~

The value of the stored procedure's Return Value, if any, after Procedure.SP executes.

For Procedure.File Exists and Procedure.Folder Exists, this token will return "True" or "False".

@Procedure.RowsAffected~

The number of rows affected by an INSERT, UPDATE, or DELETE statement, after Procedure.SQL executes. Procedure.SQL element's SQL Return Type attribute must be set to RowsAffected.

@Procedure.myProcedureID.StandardOutput~
 

When using the Procedure.Run Shell Command element, if the element's Standard Output Filename attribute has been left blank, this token contains the shell command's or application's standard console output. If there is no standard output, this will have no value.

@Procedure.myProcedureID.Stored ProcedureOutputParamID~

The data in an SP output parameter with the specified ID, after Procedure.SP executes.
Usage: @Procedure.MyProcedureID.MyOutputParamID~

@Procedure.myProcedureID.TimedOut~
 

When using the Procedure.Run Shell Command element, contains True if a timeout occurred; otherwise contains False.


Four additional Procedure tokens specific to the File Upload process are shown in the next section.

Back to top

@File Upload Tokens

A file upload is a two-step operation, as follows:

  1. An Input File Upload element is used in a report definition to receive the file and path information for the file to be uploaded and it passes this information to a process task when the report is submitted.
  2. The task uses a Save File Upload procedure to save the uploaded file.

Two different types of tokens are used to return the data from the steps in the upload operation. Due to the nature of the upload protocol, the values in the tokens are provided after the upload has already occurred. For more information, see the DevNet topic Upload Files to the Web Server.
 

Token

Resolves To

@FileUpload.UploadFileName~

The file name and extension entered in the Input File Upload element by the user, without any path information.

@FileUpload.UploadFileExtension~

The file extension of the file name entered in the Input File Upload element.

@Procedure.myProcedureID.
UploadFileName~

The file name and extension of the uploaded file.

@Procedure.myProcedureID.
UploadFileExtension~

The file extension of the uploaded file.

@Procedure.myProcedureID.
UploadFileContentType~

The MIME type or content type string of the uploaded file.

@Procedure.myProcedureID.
UploadFileLength~

The size of the uploaded file, in bytes.


Back to top

@Crosstab Tokens

These tokens provide access to values within a Crosstab Table or Crosstab-filtered chart:

Token

Resolves To

@Chart.rdCrosstabColumn-n~

A datalayer column value, in a crosstab chart, where n equals the index, beginning with 1, of the column.

@Data.rdCrosstabColumn~

The crosstab column header value.

@Data.rdCrosstabValue-n-ExtraValueCol~

The Extra Crosstab Value Column value, where n equals the index, beginning with 1, of the column.

@Data.rdCrosstabValue~

The crosstab row value.

@Data.rdCrosstabValCount~

The number of rows that were used to calculate a crosstab row value.


Back to top

Other Special Tokens

These tokens are used for special purposes:
 

Token

Resolves To

@Chart.rdExtraColumnID~

References different parts of the data (such as bar segments) when using an Extra Data Column element. Useful in determining which bar segment was clicked, for example. This token is only available for Classic static XY-type charts, not animated or Chart Canvas charts.

@Data.rdSalesforceTable~

A list of table names returned from a LIST TABLES query to Salesforce.com.

@Data.rdSalesforceField~

A list of field names returned from a LIST <tablename> query to Salesforce.com.

@Request.rdReport~

The name of the currently loaded report definition. Example: Default

@Request.rdReportFormat~

Sets/gets the exported report format as one of: PDF, NativeExcel, NativeWord, CSV, HtmlExport, HtmlEmail, Excel, Word, XML, or GoogleSpreadsheet. Doesn't exist (is null) for reports in browser.

@Session.SessionID~

The current session ID.

@Session.rdLastErrorLogFilename~

The error log file name, in the application's rdErrorLog folder, when error logging is enabled.


Back to top

Token Encoders

Under certain circumstances, you may want a token value to be encoded in order to make it "safe" for use (meaning that it won't cause errors due to invalid characters). For example, a URL stored as data may contain characters that are actually invalid in a Logi page, or a session variable value may contain characters that are invalid when processed using JavaScript, or a user may enter non-ASCII characters into a text box. Encoding these characters avoids errors that might otherwise result.

Encoders can be used with @Data, @Local, @Request, and @Session tokens. The notation for a token with an encoder included takes this format:

    @<TokenType>!<EncoderType>.<Identifier>~


Two "token encoders" are available: one that makes values safe for URLs ( !Url ), by applying HTML URL encoding, and one that makes values safe for use with JavaScript ( !Js ), by applying UTF-8 encoding. Like other aspects of tokens, the encoder names are case-sensitive.

A new token encoder ( !Json ) has been addded for use with JSON data. It encodes the characters, such as double-quotes and line feeds, that are invalid in JSON data strings. An example use-case is encoding data entered by a user into an Input Text Area control prior to sending it in an array of JSON data to a web service using REST.

Here are some examples of them in use:
 

Original Value Token with Encoder Resulting Value

http://www.logixm.com\test

@Data!Url.SiteAddress~

http%3a%2f%2fwww.logixml.com%5ctest

www.xyz.co.uk?ra=1&id=56

@Session!Url.Redirect~

www.xyz.co.uk%3fra%3d1%26id%3d56

Rain and/or snow

@Request!Js.Weather~

Rain and\x2for snow

<b>Topics</b>

@Local!Js.Headings~

\x3cb\x3eTopics\x3c\x2fb\x3e

My "dog" has fleas

@Request!Json.inpText~

My \"dog\" has fleas


Encoders allow you to very selectively encode data right at the point in the definition where it will be used.
 

Back to top