Difference between revisions of "Editable Data Grid"

From Mea Wiki
Jump to navigation Jump to search
(307281)
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''Editable Data Grid''' is a table, that shows data from QPR Suite and the data can also be edited. The Editable Data Grid uses QPR Suite Web Service to query and save data, and thus QPR Suite Web Service properties define which kind of data can be edited. Mainly QPR Metrics, QPR Portal action forms and QPR Suite user management data can be edited, where as QPR ProcessDesigner or QPR EnterpriceArchitect cannot be edited.
+
'''Editable Data Grid''' is a table, that shows data from QPR Suite and the data can also be edited. Editing possibility is the only difference to the [[Data Grid Properties|Data Grid]] presentation object. The Editable Data Grid uses QPR Suite Web Service to query and save data, and thus QPR Suite Web Service properties define which kind of data can be edited. Mainly QPR Metrics, QPR Portal action forms and QPR Suite user management data can be edited, where as QPR ProcessDesigner or QPR EnterpriceArchitect cannot be edited.
  
 
Data shown in the data grid is fetched using QPR Suite Web Service query, where each row is linked to one QPR Suite object, and each column is linked to one attribute in the QPR Suite Web Service. Note that the editable data grid does not use [[Datasets_in_QPR_UI|datasets]] to fetch data.
 
Data shown in the data grid is fetched using QPR Suite Web Service query, where each row is linked to one QPR Suite object, and each column is linked to one attribute in the QPR Suite Web Service. Note that the editable data grid does not use [[Datasets_in_QPR_UI|datasets]] to fetch data.
Line 48: Line 48:
 
|-
 
|-
 
||templateObjectQuery
 
||templateObjectQuery
||Query parameter for the QPR Suite Web Service query to get the template object to use when creating new objects. More information: http://kb.qpr.com/qpr2017-1/index.html?queryobjects.htm.
+
||QPR Suite Web Service query to get the template object to use when new objects are created. Used only when new objects are created based on a template object. If the query returns multiple objects, the first one is used as a template. If the templateObjectQuery is not defined, new objects are not created based on a template. More information about queries: http://kb.qpr.com/qpr2017-1/index.html?queryobjects.htm.
 
|-
 
|-
 
||elementType
 
||elementType
||When creating a new object, defines the type of the new object. This needs to be a type name that is supported in the namespace. Also type ID can be used.
+
||Defines the type of the created object. Used only when new objects are not created based on a template object. This needs to be a type name that is supported in the namespace. Also type ID can be used.
 
|-
 
|-
 
||namespace
 
||namespace
||When creating a new object, the ID of the namespace into which the object is to be created.
+
||Namespace into which new objects are created. When creating QPR Metrics objects, the namespace is the QPR Metrics model id. When creating QPR Portal actions forms, the namespace is ''PO''. When creating users and groups, the namespace is ''UM''. For QPR Metrics objects, the namespace can be omitted, because the namespace is assumed to be the same as the QPR Metrics model, where the parent element is located.
 
|-
 
|-
 
||columns
 
||columns
Line 66: Line 66:
 
|-
 
|-
 
||attributeParameters
 
||attributeParameters
||Parameters for the attribute. For example, ''value'' attribute supports ''period'' and ''series'' parameters, which are defined as follows: ''period=Q1/2018,series=ACT''.
+
||Parameters for the attribute. For example, ''value'' attribute supports ''period'' and ''series'' parameters, which are defined as follows: ''period=\"Q1/2018\",series=\"ACT\"''.
 
|-
 
|-
 
||headerText
 
||headerText
Line 163: Line 163:
 
|-
 
|-
 
||
 
||
[other syncfusion settings]
+
[other Syncfusion settings]
 
||
 
||
All Syncfusion datagrid settings can be used: https://help.syncfusion.com/api/js/ejgrid#members:columns
+
All Syncfusion Grid settings can be used: https://help.syncfusion.com/api/js/ejgrid#members:columns
 
|-
 
|-
 
|}
 
|}
Line 173: Line 173:
 
[other syncfusion settings]
 
[other syncfusion settings]
 
||
 
||
All Syncfusion datagrid settings can be used: https://help.syncfusion.com/api/js/ejgrid#members:columns
+
All Syncfusion Grid settings can be used: https://help.syncfusion.com/api/js/ejgrid#members:columns
 
|}
 
|}
  
Line 199: Line 199:
 
   "columns": [
 
   "columns": [
 
     {"attribute": "name", "headerText": "Measure name", "inputType": "textbox", "allowEditing": true},
 
     {"attribute": "name", "headerText": "Measure name", "inputType": "textbox", "allowEditing": true},
     {"attribute": "Numeric value", attributeParameters="series=\"SERIES1\"", "headerText": "Measure value", "inputType": "numericbox", "allowEditing": true},
+
     {"attribute": "Numeric value", "attributeParameters": "series=\"SERIES1\"", "headerText": "Measure value", "inputType": "numericbox", "allowEditing": true},
     {"attribute": "measure.value", attributeParameters="series=\"SERIES2\"", "headerText": "Date date", "inputType": "date", "allowEditing": true"},
+
     {"attribute": "measure.value", "attributeParameters": "series=\"SERIES2\"", "headerText": "Date date", "inputType": "date", "allowEditing": true},
     {"attribute": "measure.value", attributeParameters="series=\"SERIES3\"", "headerText": "Checkbox value", "inputType": "checkbox", "trueValue": "10", "falseValue": "0", "allowEditing": true"},
+
     {"attribute": "measure.value", "attributeParameters": "series=\"SERIES3\"", "headerText": "Checkbox value", "inputType": "checkbox", "trueValue": "10", "falseValue": "0", "allowEditing": true},
     {"attribute": "measure.value", attributeParameters="series=\"SERIES4\"", "headerText": "Dropdown value", "inputType": "dropdown", "dropdownOptions": [{"label": "Good", "value": "10"},{"label": "Fair", "value": "5"},{"label": "Bad", "value": "0"}], "allowEditing": true"}  
+
     {"attribute": "measure.value", "attributeParameters": "series=\"SERIES4\"", "headerText": "Dropdown value", "inputType": "dropdown", "dropdownOptions": [{"label": "Good", "value": "10"},{"label": "Fair", "value": "5"},{"label": "Bad", "value": "0"}], "allowEditing": true}  
 
   ]
 
   ]
 
}
 
}
Line 219: Line 219:
 
     "toolbarItems": ["add", "edit", "delete", "update", "cancel"]
 
     "toolbarItems": ["add", "edit", "delete", "update", "cancel"]
 
   }                             
 
   }                             
 +
}
 +
</pre>
 +
 +
Example 4: The following settings show a grid in which copies of a measure (ID of which is defined in the "templateObject" context variable) can be created under a parent measure (ID of which is defined in the "parentelementID" context variable). The grid will show all the created measures ("[<#parentelementID>].childobjects"). It's also possible to edit the values of the two series (with identifiers "ACT" and "NME") for the latest period in the created copies.
 +
<pre>
 +
{
 +
"query": "[<#parentelementID>].childobjects",
 +
"sortBy":"name",
 +
"selectedRowVariable":"gridSelectedRowID",
 +
"additionalAttributes": {"description":"New element from QPR UI","parentelementid":"<#parentelementID>"},
 +
"parentAttribute":"parentelementid",
 +
"templateObjectQuery": "[<#templateObject>]",
 +
"toolbarSettings": {"showToolbar":true,"toolbarItems":["edit","update","cancel","add"]},
 +
"editSettings": {"allowEditing": true,"allowAdding":true},
 +
"columns":
 +
  [
 +
    {"attribute": "name", "headerText":"Name", "inputType": "textbox","allowEditing":true},
 +
    {"attribute": "measure.value", "attributeParameters": "series=\"ACT\",period=\"latest\"", "headerText": "Numeric Value", "inputType": "numericbox", "allowEditing": true},
 +
    {"attribute": "measure.value", "attributeParameters": "series=\"NME\",period=\"latest\"", "headerText": "Text Value", "inputType": "textbox", "allowEditing": true}
 +
  ]
 
}
 
}
 
</pre>
 
</pre>

Latest revision as of 21:52, 29 April 2018

Editable Data Grid is a table, that shows data from QPR Suite and the data can also be edited. Editing possibility is the only difference to the Data Grid presentation object. The Editable Data Grid uses QPR Suite Web Service to query and save data, and thus QPR Suite Web Service properties define which kind of data can be edited. Mainly QPR Metrics, QPR Portal action forms and QPR Suite user management data can be edited, where as QPR ProcessDesigner or QPR EnterpriceArchitect cannot be edited.

Data shown in the data grid is fetched using QPR Suite Web Service query, where each row is linked to one QPR Suite object, and each column is linked to one attribute in the QPR Suite Web Service. Note that the editable data grid does not use datasets to fetch data.

Editable data grid is configured using JSON settings field that is available in the Data grid settings in the Presentation tab. The following table shows all available settings. See configuration examples below the table.

Property Description
additionalAttributes List of attributes and values that are saved to the object when it's created. Can be used to define a fixed parent object id for all created objects. Defined as a JSON object where the property name is the attribute name, and property value is the attribute value.

Example:

"additionalAttributes": {
  "attribute1": "value1",
  "attribute2": "value2"
}
selectedRowVariable Local context variable where currently selected row's object id of stored. Note that the selected row doesn't change, when the context variable is changed from somewhere else.
query Query parameter for the QPR Suite Web Service query to get the rows to the editable data grid. More information: http://kb.qpr.com/qpr2017-1/index.html?queryobjects.htm.
sortBy Sorting parameter for the QPR Suite Web Service query to get the rows to the editable data grid.
queryOptions Options parameter for the QPR Suite Web Service query to get the rows to the editable data grid.
parentAttribute Attribute name that is used as parent object when creating new objects to QPR Suite. The referenced parent attribute must exist either in the defined columns or in the additionalAttributes. The first case is better when user needs to select the parent from multiple options, and the latter is better when there is a fixed parent for all the created objects.
createObjectOptions Options parameter for the QPR Suite Web Service CreateObject operation (http://kb.qpr.com/qpr2017-1/index.html?createobject2.htm), that is used when a new row is created that is not based on a template object.
createCopyOptions Options parameter for the QPR Suite Web Service CreateCopy operation (http://kb.qpr.com/qpr2017-1/index.html?createcopy3.htm), that is used when a new row is created based on a template object.
deleteObjectOptions Options parameter for the QPR Suite Web Service DeleteObjects operation (http://kb.qpr.com/qpr2017-1/index.html?deleteobject2.htm), that is used when a row is deleted from the data grid.
setAttributeOptions Options parameter for the QPR Suite Web Service SetAttribute operation (http://kb.qpr.com/qpr2017-1/index.html?setattribute.htm), that is used when an attribute value is set.
templateObjectQuery QPR Suite Web Service query to get the template object to use when new objects are created. Used only when new objects are created based on a template object. If the query returns multiple objects, the first one is used as a template. If the templateObjectQuery is not defined, new objects are not created based on a template. More information about queries: http://kb.qpr.com/qpr2017-1/index.html?queryobjects.htm.
elementType Defines the type of the created object. Used only when new objects are not created based on a template object. This needs to be a type name that is supported in the namespace. Also type ID can be used.
namespace Namespace into which new objects are created. When creating QPR Metrics objects, the namespace is the QPR Metrics model id. When creating QPR Portal actions forms, the namespace is PO. When creating users and groups, the namespace is UM. For QPR Metrics objects, the namespace can be omitted, because the namespace is assumed to be the same as the QPR Metrics model, where the parent element is located.
columns Array of objects where each represent a column in the editable data grid. Following properties can be used:
Property Description
attribute QPR Suite Web Service attribute name. List of available attributes: http://kb.qpr.com/qpr2017-1/index.html?supported_parameters.htm.
attributeParameters Parameters for the attribute. For example, value attribute supports period and series parameters, which are defined as follows: period=\"Q1/2018\",series=\"ACT\".
headerText Column header text that is visible to users. Syncfusion Grid setting.
inputType

Determines which type of control is used for data input. Following options are available:

Type Description
checkbox Shows a checkbox, which is used for storing two possible values. The possible values are defined in trueValue and falseValue properties.
date Shows a date selector that can store values using XML date format (e.g. 2018-10-05T16:26:42). When reading data, both XML date format and Excel style are accepted.
dropdown Shows a dropdown list where user can select from a list of predefined items. The items are defined in the dropdownOptions property.
numericbox Shows a textbox for numeric values. It's not possible to input textual data.
relation Shows a dropdown list where a QPR Suite object can be selected. Id of the selected object is stored as the relation attribute value.
textbox Shows a textbox for storing string values.
dropdownOptions

Selectable options for the dropdown menu as an array. Only used when type is dropdown. The array has the following properties:

Property Description
label Visible text in the dropdown list.
value Attribute value to store to QPR Suite when an item is selected in the dropdown list.
trueValue Attribute value corresponding to checkbox checked state of a checkbox. Used only used when type is checkbox.
falseValue Attribute value corresponding to checkbox unchecked state. Used only used when type is checkbox.
relationQuery Query to get the list of objects to be selected from dropdown list. Used only used when type is relation.
relationLabelAttribute Attribute which values are shown in the list of object in the dropdown menu. Used only used when type is relation. By default, it's attribute name.
relationValueAttribute Attribute which value is saved to QPR Suite when selecting an item from dropdown list. Used only used when type is relation. By default, it's attribute id.
validationRules

Validation rules for the column. Provided values must pass the validations so that they can be saved. Following validation rules are available:

  • required (boolean): Value is required, i.e. it cannot be empty.
  • minlength (integer): Minimum number of charactes in a textual value.
  • maxlength (integer): Maximum number of charactes in a textual value.
  • range (two integers): Requires the value to be in given value range.
  • min (integer): Minimum for numeric value.
  • max (integer): Maximum for numeric value.
  • email (boolean): The value must be a valid email address.
  • url (boolean): The value must be a valid email URL.
  • digits (boolean): The value must contain digits only.

Examples:

"validationRules": { "required": true, "minlength": 3 }
"validationRules": { "range": [0, 100] }
allowEditing Enables (true) or disables (false) editing for the column. By default editing is disabled. Syncfusion Grid setting.
format Syncfusion Grid setting. Documentation: https://help.syncfusion.com/js/grid/columns#format.
editParams Syncfusion setting for other editing related parameters (https://help.syncfusion.com/api/js/ejgrid#members:columns-editparams). For example, number of decimals for numericbox input type:
"editParams": { "decimalPlaces": 2 }

[other Syncfusion settings]

All Syncfusion Grid settings can be used: https://help.syncfusion.com/api/js/ejgrid#members:columns

[other syncfusion settings]

All Syncfusion Grid settings can be used: https://help.syncfusion.com/api/js/ejgrid#members:columns

Configuration examples

Example 1: List all scorecards in the Metrics environment. Scorecard names, identifiers and descriptions can be edited.

{
  "query": "[SC].models.scorecard",
  "sortBy": "name",
  "selectedRowVariable": "selectedScorecardId",
  "columns": [
    {"attribute": "name", "headerText": "Scorecard name", "inputType": "textbox", "validationRules": { "minlength": 5 }, "allowEditing": true},
    {"attribute": "symbol", "headerText": "Scorecard identifier", "inputType": "textbox", "validationRules": { "required": true }, "allowEditing": true},
    {"attribute": "description", "headerText": "Scorecard  description", "inputType": "textbox", "allowEditing": true} 
  ]
}

Example 2: List of measures in a single scorecard. The scorecard id must be available in the myScorecard variable.

{
  "query": "[<#myScorecard>].measures",
  "sortBy": "name",
  "selectedRowVariable": "selectedMeasureId",
  "columns": [
    {"attribute": "name", "headerText": "Measure name", "inputType": "textbox", "allowEditing": true},
    {"attribute": "Numeric value", "attributeParameters": "series=\"SERIES1\"", "headerText": "Measure value", "inputType": "numericbox", "allowEditing": true},
    {"attribute": "measure.value", "attributeParameters": "series=\"SERIES2\"", "headerText": "Date date", "inputType": "date", "allowEditing": true},
    {"attribute": "measure.value", "attributeParameters": "series=\"SERIES3\"", "headerText": "Checkbox value", "inputType": "checkbox", "trueValue": "10", "falseValue": "0", "allowEditing": true},
    {"attribute": "measure.value", "attributeParameters": "series=\"SERIES4\"", "headerText": "Dropdown value", "inputType": "dropdown", "dropdownOptions": [{"label": "Good", "value": "10"},{"label": "Fair", "value": "5"},{"label": "Bad", "value": "0"}], "allowEditing": true} 
  ]
}

Example 3: The following settings can be used to control, whether there are adding, deleting and editing functions available:

{
  "editSettings": {
    "allowAdding": true,
    "allowDeleting": true,
    "allowEditing": true
  },
  "toolbarSettings": {
    "showToolbar": true,
    "toolbarItems": ["add", "edit", "delete", "update", "cancel"]
  }                             
}

Example 4: The following settings show a grid in which copies of a measure (ID of which is defined in the "templateObject" context variable) can be created under a parent measure (ID of which is defined in the "parentelementID" context variable). The grid will show all the created measures ("[<#parentelementID>].childobjects"). It's also possible to edit the values of the two series (with identifiers "ACT" and "NME") for the latest period in the created copies.

{
"query": "[<#parentelementID>].childobjects",
"sortBy":"name",
"selectedRowVariable":"gridSelectedRowID",
"additionalAttributes": {"description":"New element from QPR UI","parentelementid":"<#parentelementID>"},
"parentAttribute":"parentelementid", 
"templateObjectQuery": "[<#templateObject>]", 
"toolbarSettings": {"showToolbar":true,"toolbarItems":["edit","update","cancel","add"]},
"editSettings": {"allowEditing": true,"allowAdding":true},
"columns":
  [
    {"attribute": "name", "headerText":"Name", "inputType": "textbox","allowEditing":true},
    {"attribute": "measure.value", "attributeParameters": "series=\"ACT\",period=\"latest\"", "headerText": "Numeric Value", "inputType": "numericbox", "allowEditing": true},
    {"attribute": "measure.value", "attributeParameters": "series=\"NME\",period=\"latest\"", "headerText": "Text Value", "inputType": "textbox", "allowEditing": true}
  ]
}

Note that the batch editing is not supported by the editable data grid ("editSettings": { "editMode" : "batch" })