Dataset Tag in QPR UI

From Mea Wiki
Revision as of 06:58, 7 November 2017 by TeeHiet (talk | contribs) (TeeHiet moved page Dataset Tag in QPR MobileDashboard to Dataset Tag in QPR UI: 403760)
Jump to navigation Jump to search

Dataset tag is used to convert a dataset into a JSON format to be used for example in a chart or datagrid JSON settings. Data appear in proper datatypes in the JSON. Following datatypes are supported: string, integer, double, boolean and datetime. Datetime is presented as integer in milliseconds from 01 January 1970 00:00:00 UTC.

Parameters:

  • identifier: Used dataset identifier.
  • grouping: When grouping is defined, JSON is structured in a two level hierarchy. Grouping is defined using the following format: [Group column name in dataset];[Group attribute name in JSON];[Inner array attribute name in JSON]. In the hierarchy the outer level contains an object array where the objects have two attributes: the defined Group attribute name in JSON and Inner array attribute name in JSON. Group attribute name in JSON contains the group name, and Group attribute name in JSON contains an object array where there is data of that single group.
  • [all other parameters]: All other parameters define column mappings from the dataset to the JSON presentation. Parameter name is the column name in the formatted JSON and parameter value is column name in the dataset. If referenced column is not found, an error is returned. All unmapped columns in the dataset are mapped with same names in JSON. Empty value means that if the dataset contains the defined column, it is not mapped.

Examples:

  • <#dataset identifier="scorecards" name="scorecardName" x="" y="revenue" color="statusColor">
  • If there is a dataset with columns A, B and C, and there is a tag <#dataset identifier="datasetname" D="A" B="">, the resulting JSON contains columns D and C. Column A as mapped with the name D, column B is not mapped at all and C as mapped with the same name.
  • Grouping example:

There is the following dataset with identifier MetricsQuery (presented here in CSV format):

Country;Year;Efficiency
India;2015;28
India;2016;25
India;2017;26
Germany;2015;31
Germany;2016;28
Germany;2017;30
England;2015;36
England;2016;32
England;2017;34

With tag <#dataset identifier="MetricsQuery" grouping="Country;name;points" x="Year" y="Efficiency"> the result is as follows:

[
  {
    "points": [{"x": 2015, "y": 28}, {"x": 2016, y: 25}, {"x": 2017, "y": 26}],						 
    "name": "India"
  },						
  {
    "points": [{"x": 2015, "y": 31}, {"x": 2016, "y": 28}, {"x": 2017, "y": 30}],						 
    "name": "Germany"
  },
  {
    "points": [{"x": 2015, "y": 36}, {"x": 2016, "y": 32}, {"x": 2017, "y": 34}],						 
    "name": "England"
  }
]