Expression Tag in QPR UI
Expression tag is used to calculate an expression (formula) and show its result in place of the tag. Context variables can be used in the expressions with square bracket syntax, for example [VariableName]. If the expression returns a date or numeric type of data, the data is converted into string using the browsers current locale settings. The expression is recalculated if the context variables used by the expression changes.
QPR UI uses Syncfusion expression language. See all available functions: https://help.syncfusion.com/js/calculate/supported-formulas/supported-formulas.
- value: Expression to evaluate.
- escape: Escaping/encoding applied to the result to make the value compatible with its placement context, e.g. inside string literal quotation marks. Available escapings are the same as in the Variable tag.
<#expression value="SQRT([variable1] * [variable1] + [variable2] * [variable2])"> <#expression value="LEFT(\"limit this string to 17 characters\", 17)"> <#expression value="UPPER(\"show me in upper case\")"> <#expression value="YEAR(NOW())"> <#expression value="EDATE(NOW(), 12)">
Note that the expression language works in a way that it returns 0 for empty strings. Also string literals are returned enclosed by quotation marks. For example, <#expression value="\"abc\""> returns "abc" which might not be logical, as the result should not contain quotation marks. To workaround the issue, you can use the concatenate function, for example: <#expression value="concatenate(\"abc\", \"\")">. Strings returned by functions don't have this issue.
The cell function is used to get a single cell value from a dataset. The cell function can be used for example when there is a query that only returns a single value (dataset with only one column and one row), or to get a specific value from a query that returns multiple values.
- Dataset identifier: Mandatory identifier of the used dataset. Error is caused if the referenced dataset identifier is not found.
- Column name or column index: Referenced column name or index in the dataset. This parameter is optional, and if omitted, the first column of the dataset is referenced. If the provided parameter is string, it means column name; if it's numerical, it means column index.
- Row index: Referenced row number in the dataset (starting from 1). This parameter is optional and if omitted, the first row is used.
- Default value: The optional default value is returned if the referenced column name, column index or row index does not exist. If no default value is defined in those cases, an error is caused.
<#expression value="cell(\"myScorecard\")"> <#expression value="cell(\"myScorecard\", \"symbol\", 3)"> <#expression value="cell(\"myScorecard\", 2, 3)"> <#expression value="cell(\"myScorecard\", 1, 1, \"Default value\")">
The info function is used to access different kind of user, session and context related information, that is useful for building views. The function has one string valued parameter with following options:
|paSessionId||QPR ProcessAnalyzer session id. This is empty if there is no session for QPR ProcessAnalyzer. If Common QPR Authentication is used, QPR UI doesn't have the QPR ProcessAnalyzer session id, and in that case paSessionId contains the QPR UI session id.|
|paWsUrl||QPR ProcessAnalyzer web service url. The result is empty if QPR ProcessAnalyzer web service url has not been configured. Example: https://demo.qpr.com/QPRPA/MainService.svc/webHttp/.|
|sessionContext||Current session context variables encoded to a url form. Example: sys:dashboard=1234&var1=value1&val2=value2.|
|sessionId||QPR UI session id.|
|qprSuiteSessionId||QPR Suite session id. This is empty if there is no session for QPR Suite. If Common QPR Authentication is used, QPR UI doesn't have the QPR Suite session id, and in that case qprSuiteSessionId contains the QPR UI session id.|
|qprSuiteWsUrl||QPR Suite web service url. The result is empty if QPR Suite web service url has not been configured. Example: https://demo.qpr.com/QPR2017-1/Portal/QPR.Isapi.dll/wsforward/MainService.svc/webHttp/.|
|uiLanguage||Language code of the currently active UI language. Available UI language codes: en_US (English), fi_FI (Finnish), ar (Arabic).|
|userFullName||Full name of the currently logged in user. If both QPR Suite and QPR ProcessAnalyzer are in use, the non empty full name is used. If both are not empty, full name stored in QPR Suite is used.|
|userGroups||Groups of the currently logged in user as a JSON array (groups are sorted alphabetically). If both QPR Suite and QPR ProcessAnalyzer are in use, the list contains groups in both of them. QPR ProcessAnalyzer groups where the user is as a hidden member, are not shown, because permissions restrict that user is not allowed to get that information. Example: ["group1", "group2", "group3"].|
|userId||Id of the currently logged in user in QPR UI. Note that QPR Suite and QPR ProcessAnalyzer user id's are different than QPR UI user id.|
|userLoginName||User login name of the currently logged in user.|
|version||QPR UI release version number. Example: 2018.1.0.1234.|
To use a context variable as an argument for the info function, use an info function name listed above as the context variable value and then provide the context variable name as an argument for the expression.
QPR Suite session id:
Url to the current view:
<#expression value="Concatenate(info(\"baseUrl\") & \"#/dashboard?\" & info(\"sessionContext\"))">
Using a context variable named "mycontext" as the argument:
Concatenate function needs to be used to avoid adding unnesessary quotation marks.