Difference between revisions of "Expression Tag in QPR UI"

From Mea Wiki
Jump to navigation Jump to search
Line 42: Line 42:
 
* '''baseUrl''': Beginning part of the QPR MobileDashboard url (until the hash sign). Url is fetched using JavaScript command '''window.location.href'''. Example: '''<nowiki>https://demo.qpr.com/mobiledash/</nowiki>'''.
 
* '''baseUrl''': Beginning part of the QPR MobileDashboard url (until the hash sign). Url is fetched using JavaScript command '''window.location.href'''. Example: '''<nowiki>https://demo.qpr.com/mobiledash/</nowiki>'''.
 
* '''sessionContext''': Parameters of the currently opened QPR MobileDashboard view encoded to a url form, i.e. the session context. Example: '''sys:dashboard=1234&var1=value1&val2=value2'''.
 
* '''sessionContext''': Parameters of the currently opened QPR MobileDashboard view encoded to a url form, i.e. the session context. Example: '''sys:dashboard=1234&var1=value1&val2=value2'''.
* '''username''': User name of the currently logged in user.
+
* '''userLoginName''': User name of the currently logged in user.
 
* '''userFullName''': Full name of the currently logged in user.
 
* '''userFullName''': Full name of the currently logged in user.
 
* '''userGroups''': Groups of the the currently logged in user as a JSON array. Example: '''["group1", "group2", "group3"]'''.
 
* '''userGroups''': Groups of the the currently logged in user as a JSON array. Example: '''["group1", "group2", "group3"]'''.

Revision as of 07:51, 24 October 2017

Expression tag is used to calculate an expression (formula) and show its result in place of the tag. It's possible to use context variables in expressions using square brackets, 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 calculated again if the context variables used by the expression changes.

QPR uses Syncfusion Calculate expression language. See all available functions here: https://help.syncfusion.com/js/calculate/supported-formulas/supported-formulas

Parameters:

  • value: Expression string to calculate.
  • escape: Determines which escaping or encoding is applied to the calculation result so that the value is compatible with its context, e.g. inside string literal quotation marks. Available escapings are the same as in the Variable tag.

Note that the expression language works in a way that it returns 0 for empty strings, and also string literals are returned enclosed by quotation marks. For example, <#expression value="\"abc\""> returns "abc" which might not be consistent (the result should not contain quotation marks). To workaround the issue, you can use concatenate function, for example: <#expression value="concatenate(\"abc\", \"\")"> (strings returned by functions don't have this issue).

Examples:

  • <#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)">

Functions supported in upcoming releases

Note: This chapter contains documentation for features that are not released yet, but will be available in near future!

Cell function

Cell function is used to retrieve a single cell value from a dataset. It's usually used when there is a query to retreave a single value, such as object name - in that case the returned dataset contains only one row and column.

Parameters:

  1. name: Identifier of the referenced dataset. This parameter is mandatory.
  2. columnName/columnIndex: 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.
  3. rowIndex: Referenced row number in the dataset (starting from 1). This parameter is optional and if omitted, the first row is used.

Error is caused if the referenced dataset identifier, columnName, columnIndex or rowIndex is not found.

Examples:

  • <#expression value="cell(\"scorecard\")">
  • <#expression value="cell(\"scorecard\", \"symbol\", 3)">
  • <#expression value="cell(\"scorecard\", 2, 3)">

Info function

Info function is used to access different kinds of user, session and context related information, that are useful for building the user interface logic. The function has one string valued parameter with following options:

  • sessionId: QPR MobileDashboard session id.
  • qprSuiteSessionId: QPR Suite session id (empty if there is no active session to QPR Suite).
  • paSessionId: QPR ProcessAnalyzer session id (empty if there is no active session to QPR ProcessAnalyzer).
  • baseUrl: Beginning part of the QPR MobileDashboard url (until the hash sign). Url is fetched using JavaScript command window.location.href. Example: https://demo.qpr.com/mobiledash/.
  • sessionContext: Parameters of the currently opened QPR MobileDashboard view encoded to a url form, i.e. the session context. Example: sys:dashboard=1234&var1=value1&val2=value2.
  • userLoginName: User name of the currently logged in user.
  • userFullName: Full name of the currently logged in user.
  • userGroups: Groups of the the currently logged in user as a JSON array. Example: ["group1", "group2", "group3"].
  • userId: QPR MobileDashboard user id. Note that this is not a QPR Suite or QPR ProcessAnalyzer user id.
  • uiLanguage: Language code of the currently active UI language. Available UI language codes: en_US (English), fi_FI (Finnish), ar (Arabic).
  • qprSuiteWsUrl: QPR Suite web services url. Example: https://demo.qpr.com/QPR2017-1/Portal/QPR.Isapi.dll/wsforward/MainService.svc/webHttp.
  • paWsUrl: QPR ProcessAnalyzer web services url.
  • version: QPR MobileDashbaord version: Example: 2017.6.1.3402.

Examples:

  • QPR Suite session id: <#expression value="info(\"qprSuiteSessionId\")">
  • Url to the current view: <#expression value="info(\"baseUrl\") & \"#/dashboard?\" & info(\"sessionContext\")">