Difference between revisions of "Dynamic Tags in QPR UI"

From Mea Wiki
Jump to navigation Jump to search
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
QPR supports tags that are defined in this page.
+
''Tags'' can be used in many settings fields when designing dashboards to add dynamic behaviour to the dashboards. If a tag used in a presentation object's settings field refers to a context variable, and that variable values changes, also that setting field value changes and the presentation object updates to reflect the new settings.
  
== Supported tags ==
+
'''Evaluating''' a tag means that the tag is parsed (detected) from the containing text, its intended behaviour is executed and the tag definition is replaced by the tag's return value. Tags in textual settings are always evaluated before the setting value is used by the UI element. During the tag evaluation the setting value is treated as text only, although it might be JSON, SVG or CSS.
* [[Variable Tag in QPR MobileDashboard|Variable tag]]
 
* [[Expression Tag in QPR MobileDashboard|Expression tag]]
 
* [[Action Tag in QPR MobileDashboard|Action tag]]
 
* [[Dataset Tag in QPR MobileDashboard|Dataset tag]] (supported in MDB 2017.8 release)
 
  
== General about dynamic tags ==
+
Tags have the following syntax: '''<#tagname parameter1="value1" parameter2="value2" ... parameterN="valueN">'''
In some UI element textual settings it is possible to use some of the below defined tags to achieve more dynamic behaviour of dashboards.
 
  
'''Evaluating''' a tag means that
+
In more details:
# The tag is parsed (detected) from the containing text
+
* Tag starts with '''<#tagname''', where '''tagname''' is the name of the tag, and ends with '''>''' character.
# Its intended behaviour is executed
 
# The tag definition is replaced by the tag's return value
 
 
 
Tags in textual settings are always evaluated before the setting value is used by the UI element. During the tag evaluation the setting value is treated as text only, although it might be JSON, SVG or CSS.
 
 
 
== Tag definition syntax ==
 
Tag syntax has the following general form: '''<#tagname parameter1="value1" parameter2="value2" ... parameterN="valueN">'''
 
 
 
In more details, tags have the following syntax:
 
* Tag starts with '''<#tagname''', where '''tagname''' is the name of the tag. There is always a space after the tagName.
 
* Tag ends with '''>''' character.
 
 
* Tag contains one or many parameters as name-value pairs (parameters are separated by space).
 
* Tag contains one or many parameters as name-value pairs (parameters are separated by space).
 
* Parameter name is followed by '''=''' which is followed by parameter value in double-quotes ('''"''').
 
* Parameter name is followed by '''=''' which is followed by parameter value in double-quotes ('''"''').
Line 28: Line 12:
 
* Newline characters are not allowed in tags (if a newline character is encountered, the searched text ends)
 
* Newline characters are not allowed in tags (if a newline character is encountered, the searched text ends)
  
Tag is assumed if tag start '''<#tagname''' (including the space) appears in the text. If the syntax doesn't continue according to the syntax rules, an error is caused. This means that the tag parser needs to know which tags names are available in the parsed content.
+
Escaping examples:
 +
<pre>
 +
<#action name="drill\\down\"abc\""> (name parameter contents: drill\down"abc")
 +
</pre>
  
Examples of syntaxes that cause tag parsing error:
+
A tag is assumed if a text contains '''<#tagname ''' (including the space) appears in the text. If the syntax doesn't continue according to the syntax rules, an error is caused.
* <#variable name="var1"
 
* <#variable name="var1"escape="json">
 
* <#variable name="var1" escape=json">
 
* <#variable name="var1" escape=json>
 
* <#variable name="var"1" escape="json">
 
  
Examples of syntax that doesn't cause error, because the beginning is not interpreted as a tag (assuming "variable" tags can be used in the parsed content):
+
== Available tags ==
* '''<variable''' (hash character missing)
+
* [[Variable Tag in QPR UI|Variable tag]]
* '''<#variables''' (no space after "variable")
+
* [[Expression Tag in QPR UI|Expression tag]]
 
+
* [[Dataset Tag in QPR UI|Dataset tag]]
Escaping examples:
 
* <#action name="drill\\down\"abc\""> (name parameter contents: drill\down"abc")
 
  
 
== Settings where tags can be used ==
 
== Settings where tags can be used ==
 
Dynamic tags can be used in following settings:
 
Dynamic tags can be used in following settings:
* [[Data Grid Properties|Data Grid]] presentation object '''JSON settings''' field (Variable tag and the short syntax)
+
* [[Data Grid Properties|Data Grid]] presentation object '''JSON settings''' field
* [[SVG Properties|SVG]] presentation object '''SVG code''' field (Action tag, Variable tag and and the short syntax)
+
* [[HTML Properties|HTML]] presentation object '''HTML code''' field
* [[Panel Properties|Panel]] and any presentation object '''Name''' field (Variable tag and the short syntax)
+
* [[SVG Properties|SVG]] presentation object '''SVG code''' field
* ProcessAnalyzer and QPR Suite web service queries in data grid presentation object's Query tab (Variable tag and the short syntax)
+
* [[Panel Properties|Panel]] and any presentation object '''Name''' field
 
+
* [[Datasets in QPR UI|Dataset]] query and parameter fields
= Tags supported in future =
+
* QPR Suite Web Service query and parameter fields in Gata Grid presentation object's Query tab
 
 
== Translate tag ==
 
Translate tag is used to get a translated value for a string from a translation table (translation table is a separate feature). This tag is helpful in building multilingual dashboards. If translation text is not found from the translations table, the original translatable text is returned.
 
 
 
Parameters:
 
* '''text''': Text to translate. This parameter is mandatory.
 
* '''context''': Defined in which context the translatable text appears. This enables to have different translations for same translatable text. If omitted, empty context is assumed.
 
* '''language''': Language name to which translate the text. This parameter is optional, and if omitted, the current UI language is assumed.
 
  
Examples:
+
[[Category: QPR UI]]
* <#translate text="Renenue">
 
* <#translate text="Renenue" context="bookkeeping">
 
* <#translate text="Renenue" language="FI">
 

Latest revision as of 10:30, 11 December 2020

Tags can be used in many settings fields when designing dashboards to add dynamic behaviour to the dashboards. If a tag used in a presentation object's settings field refers to a context variable, and that variable values changes, also that setting field value changes and the presentation object updates to reflect the new settings.

Evaluating a tag means that the tag is parsed (detected) from the containing text, its intended behaviour is executed and the tag definition is replaced by the tag's return value. Tags in textual settings are always evaluated before the setting value is used by the UI element. During the tag evaluation the setting value is treated as text only, although it might be JSON, SVG or CSS.

Tags have the following syntax: <#tagname parameter1="value1" parameter2="value2" ... parameterN="valueN">

In more details:

  • Tag starts with <#tagname, where tagname is the name of the tag, and ends with > character.
  • Tag contains one or many parameters as name-value pairs (parameters are separated by space).
  • Parameter name is followed by = which is followed by parameter value in double-quotes (").
  • If parameter value contains double-quotes they are escaped with \ character, example \". \ character is escaped with \\.
  • Newline characters are not allowed in tags (if a newline character is encountered, the searched text ends)

Escaping examples:

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

A tag is assumed if a text contains <#tagname (including the space) appears in the text. If the syntax doesn't continue according to the syntax rules, an error is caused.

Available tags

Settings where tags can be used

Dynamic tags can be used in following settings:

  • Data Grid presentation object JSON settings field
  • HTML presentation object HTML code field
  • SVG presentation object SVG code field
  • Panel and any presentation object Name field
  • Dataset query and parameter fields
  • QPR Suite Web Service query and parameter fields in Gata Grid presentation object's Query tab