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.
- About Tokens
- "Nesting" Tokens
- Token Types
- @Function Tokens
- @Date Tokens
- File Upload Tokens
- Other Special 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:
They must start with the @ symbol and end with the ~ (tilde) symbol, and they're case-sensitive. That bears repeating as developers typically run afoul of these two things: tokens must end with a ~ and they're case-sensitive.
@Data.CustomerID~ does not equal @Data.customerid~
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 run time, 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 Work with 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:
then the Division element would be shown. These URLs:
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.
Beginning in v11.0.43, Logi Studio includes a token validator feature which will display an "Invalid Token" warning if it detects a malformed token (usually a missing tilde) in an element attribute. Click the warning image to be taken to the offending token in the report definition.
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. For more information, see the Intelligent Token Completion Feature section of Use Studio 11.
Because the token is a placeholder that gets resolved at runtime, it's possible to make tokens themselves dynamic. This is done by making part of the token identifier itself a token. Consider this token construction:
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:
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".
Nesting only works with Request, Local, Data, and Constant tokens, and only one level of nested tokens will be resolved, so this won't work:
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.
The following tokens types are available in Logi reporting products:
Represent values set in the Application object, either in the Web.config file or in an integrated .NET application. These values are for global variables that span all instances of the application.
Format: @Application.<session param ID> Example: @Application.LogFileFolder~
Represents a data value from the child datalayer of a Chart or Chart Canvas element.
Format: @Chart.<column name>~ Example: @Chart.OrderDate~
Represents the True or False result of a Compare Filter evaluation. (v11.0.127+) Not available in Logi Report.
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~
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~
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~
Represents relative dates for reports and report scheduling (see Date Identifiers list below).
Format: @Date.<date identifier>~ Example: @Date.Yesterday~
Returns information in a procedure task about a file upload process (see File Upload Tokens, below).
Represents the value of predefined functions (see Function Identifiers below).
Format: @Function.<function name>~ Example: @Function.DateTime~
Represents a data value from the child datalayer of a Heat Map element (deprecated in v11.0.727).
Format: @Heatmap.<column_name >~ Example: @Heatmap.StoreSales~
Format: @Input.<value ID>~ Example: @Input.FileName~
Represents a data value from the first row of the child datalayer of a Local Data element (see Introducing Datalayers). 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~
Represents the value of XOLAP measures; used only in the XOLAP Formula attribute of the XOLAP Calculated Measure element. (v10.2.224+)
Format: @Measure.[<measure name>]~ Example: @Measure.[Sales Amount]~
Represents results of operations by Process task procedures, including datasource interactions, file system and email operations, and associated error messages (see Special Identifiers below). Not available in Logi Report.
Format: @Procedure.<procedure ID>.<value ID>~ Example: @Procedure.GetTaxes.SalesTax~
Represents a data value from the child datalayer of a Repeat Elements element. (v11.1.033+)
Format: @Repeat.<Column Name>~ Example: @Repeat.data_type~
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~
Represents the values of the application's Session variables, which are unique for each user session.
Format: @Session.<session param ID> Example: @Session.SessionID~
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>.<identifier>~ Example: @SingleQuote.Request.MyElementID~
Deprecated. No longer a valid token.
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~.
The complete physical path of the application's virtual directory on the web server. Example: C:\inetpub\wwwroot\MyLogiApp
The physical path of the application's rdDataCache folder on the web server. Example: C:\inetpub\wwwroot\MyLogiApp\rdDataCache
The physical path of the application's rdDownload folder on the web server. Example: C:\inetpub\wwwroot\MyLogiApp\rdDownload
The HTTP Request.Path string.
The HTTP Request.Browser string.
The client browser's decimal character.
The HTTP Request.Browser.MajorVersion string.
The HTTP Request.Browser.MinorVersion string.
The client browser's thousand separator character.
The HTTP Request.UserAgent string.
The HTTP Request.Browser.Version string.
The current web server date as a short date string.
The current web server date and time as a general date string.
When the If Data Error element is processed, provides the element ID of the datalayer that encountered the error. (v10.0.319)
The information in a procedure task about a file upload process.
A Functional Unique Identifier string, a unique 16-byte identifier used in Windows Portable Devices.
A random Globally Unique Identifier string. This function is useful for creating unique filenames.
The IP address of the client (browser) computer.
The Instance ID value of a Dashboard Panel, in dashboards that have Multiple Instances set to True. (v10.0.337)
The last error message string for any process task executed in the current session.
The number of data table pages. Only valid when Interactive Paging or Printable Paging elements are in use.
The current data table page number. Only valid when Interactive Paging or Printable Paging elements are in use.
The entire query string (everything after the "?").
The complete URL of the calling web page.
The current data table row number.
The name of the web server. E.g.: localhost
The current web server session ID.
The current web server time, translated to UTC (Greenwich Mean Time) time, in 24-hour format, as hh:mm:ss
The browser's primary language string.
The current, logged-in user ID or name, when Logi Security is in use. See Introduction to Logi Security 10.
A comma-delimited list of the current, logged-in user's security rights, when Logi Security is in use. See Introduction to Logi Security 10.
A comma-delimited list of the current, logged-in user's security roles, when Logi Security is in use. See Introduction to Logi Security 10.
The token identifiers listed in the table below all deal with dates. For example, to return yesterday's date, enter @Date.Yesterday~.
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. 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 Time Period Columns element can also be used to parse specific date parts out of @Date token values.
@Date Token Identifiers
* introduced in v11.4.046
A file upload is a two-step operation, as follows:
- 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.
- 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.
The file name and extension entered in the Input File Upload element by the user, without any path information.
The file extension of the file name entered in the Input File Upload element.
The file name and extension of the uploaded file.
The file extension of the uploaded file.
The MIME type or content type string of the uploaded file.
The size of the uploaded file, in bytes.
These tokens are used for special purposes:
A specific datalayer column value, in a crosstab chart, where n equals the index, beginning with 1, of the column.
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.
The crosstab column header.
The crosstab row value.
The number of rows that were used to calculate a crosstab row value.
A list of table names returned from a LIST TABLES query to Salesforce.com.
A list of field names returned from a LIST <tablename> query to Salesforce.com.
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.
The last error message string for the procedure with the specified ID.
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.
The value of the stored procedure's Return Value, if any, after Procedure.SP executes.
The data in an SP output parameter with the specified ID, after Procedure.SP executes.
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.
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.
The current session ID.
The error log file name, in the application's rdErrorLog folder, when error logging is enabled.