Dynamic Tags in QPR UI

From Mea Wiki
Revision as of 20:25, 27 April 2017 by Ollvihe (talk | contribs) (Created page with "Note: Documentation in this page applies for upcoming QPR MobileDashboard versions. == General about text tags == In some QPR MobileDashboard UI element settings it is possib...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note: Documentation in this page applies for upcoming QPR MobileDashboard versions.

General about text tags

In some QPR MobileDashboard UI element settings it is possible to use some of the below defined tags. The tags are always evaluated before the setting value is used by the UI element. When the tag is evaluated, the setting text string is treated only as text, altough it might be JSON, SVG or CSS.

Tag syntax

Tags have following syntax:

* Tags start with <# and end with >
* Start <# is followed by 

contain tag name Tag parsing and syntax errors: - Tag is assumed and tag parsing starts, if text contains "<#tagname " (note, last character is space) - Error is thrown during parsing when the tag is syntactically incorrect, examples of syntactically incorrect definitions

<#variable name="var1"
<#variable name="var1"escaping="json">
<#variable name="var1" escaping=json">
<#variable name="var1" escaping=json>
<#variable name="var"1" escaping="json">

Variable tag

Variable tag references to a context variable, i.e. when the tag is evaluated the tag is replaced by context variable value. The value is taken from the effective context of that UI element, where the tag resides. When the referenced context variable value changes, the UI element, which setting contain the variable tag, is also refreshed. UI element decides the logic how the UI element is refreshed. Variable tag is not able change the context variable value.

Variable tag contains following parameters:

* name: Name of the referenced context variable. This parameter is mandatory.
* escape: Determines how the context variable value is manipulated before the value is replaced to the text. This parameter is used so that the value fits in place, e.g. inside string literal quotation marks.
** none (default value)
** json (chars to escape: "\)
** javascript (chars to escape: "'\)
** xml (chars to escape: <>&'")
* jsonpath: Contains a JSON path expression (more information: https://github.com/json-path/JsonPath). Context variable value is expected to contain a JSON value and instead of replacing the whole JSON value, the JSON path expression is evaluated for the JSON value and the result is replaced.

Examples: <#variable name="variable1" escape="json"> <#variable name="somejsondata" jsonpath="$.store.book[0].title">

Action tag

Action tag references to a QPR MobileDashboard action. The Action tag is used in a javascript code, because the replaced value is a call to a javascrip function.

Paramaters:

* name: action identifier (mandatory)
* [action parameters]

Info tag

Info tag is used to access different session and context related values, that may be useful in dashboards.

Parameter:

* name: property/setting name, examples: enticeSessionId, meaSessionId, paSessionId, baseUrl, bookmarkUrl, username, uiLanguage

Datasetcell tag

Datasetcell tag is used retrieves a single cell value from a dataset.

Parameters:

* name: referenced dataset identifier.
* columnName: column name where to get data (by default the first column)
* columnIndex: column index (alternative to columnName)
* rowIndex: row number where the to get data (by default the first data row)

Translate tag

Translate tag is used to

Parameter:

* text: text to translate
* context: enables to have different translations for same texts


<#action name="drilldownToCities" param1="value1" param2="value2"> <#info name="sessionId"> <#datasetref identifier="scorecards" column="scorecardName" row="3">

Escapings: string in parameters are escaped with JSON escaping

* Example: <#action name="drill\\down\"abc\""> (name parameter contents: drill\down"abc")

Context variable quick reference

In addition to the Variable tag, there is a quick reference option for context variables.

<#variable1> {#variable1} (legacy) (no escaping)