Difference between revisions of "QPR Reporting Expression"

From Mea Wiki
Jump to navigation Jump to search
Line 13: Line 13:
 
<pre>
 
<pre>
 
instances=From('[PG].models.subobjects.instances', '', '', 'name,id', '')
 
instances=From('[PG].models.subobjects.instances', '', '', 'name,id', '')
calculateColumns=AddColumn(AddColumn([instances], 'elementInstanceId', 'InstanceIdFromFullId([id])'), 'elementWidth', 'ConvertToDouble(ItemAt(SubAttributesAsArray([id], \'graphicalproperties\', \'width\', \'[instanceid]=[elementInstanceId]\'), 0))')
+
getWidth=AddColumn(AddColumn([instances], 'elementInstanceId', 'InstanceIdFromFullId([id])'), 'elementWidth', 'ConvertToDouble(ItemAt(SubAttributesAsArray([id], \'graphicalproperties\', \'width\', \'[instanceid]=[elementInstanceId]\'), 0))')
sortedData=SortBy([calculateColumns], 'elementWidth desc')
+
sortedData=SortBy([getWidth], 'elementWidth desc')
 
getMax20=Where(AddColumn([sortedData], 'rowordernumber', '[rowordernumber]'), '[rowordernumber] < 20')
 
getMax20=Where(AddColumn([sortedData], 'rowordernumber', '[rowordernumber]'), '[rowordernumber] < 20')
 
</pre>
 
</pre>
 
[[Category: QPR UI]]
 
[[Category: QPR UI]]

Revision as of 16:20, 16 November 2017

When querying the Generic Web Service, use the QPR Reporting Expressions.

Examples

The following query will count how many scorecards there are in each QPR Metrics model:

scorecards=From('[SC].models.scorecard', '', '', 'model.name(as="modelname"),id')
countSums=SortBy(GroupBy([scorecards], Array('modelname'), Array('numberOfScorecards'), Array('ArraySize([id])')), 'numberOfScorecards DESC')
sortedResult=SortBy([countSums], 'numberOfScorecards DESC')

The following query will return 20 process element instances which have the greatest width in the flowchart.

instances=From('[PG].models.subobjects.instances', '', '', 'name,id', '')
getWidth=AddColumn(AddColumn([instances], 'elementInstanceId', 'InstanceIdFromFullId([id])'), 'elementWidth', 'ConvertToDouble(ItemAt(SubAttributesAsArray([id], \'graphicalproperties\', \'width\', \'[instanceid]=[elementInstanceId]\'), 0))')
sortedData=SortBy([getWidth], 'elementWidth desc')
getMax20=Where(AddColumn([sortedData], 'rowordernumber', '[rowordernumber]'), '[rowordernumber] < 20')