Hi,
I need to create a pie chart with the output from expression rule.
I can use a!queryEntity() if the output is in Datastore entity with the help of aggregation functions.
Can anyone help me how to store the expression rule output to Data store entity or how to use the rule output directly in pie chart creation.
Thanks in advance.
Discussion posts and replies are publicly visible
You can use the output directly by indexing your data from the query rule and applying loop on the chart series and again indexing the labels and counts.
In case you are not clear with the above answer please refer to the code below.
a!localVariables( local!selectedDepartment, /* This query fetches the grouped data for the pie chart. */ local!chartDatasubset: a!queryEntity( entity: cons!EMPLOYEE_ENTITY,/*entity name */ query: a!query( aggregation: a!queryAggregation( aggregationColumns: { a!queryAggregationColumn( field: "department", isGrouping: true ), a!queryAggregationColumn( field: "id", alias: "id_count", aggregationFunction: "COUNT" ) } ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: -1, sort: a!sortInfo( field: "department", ascending: true ) ) ) ), { a!pieChartField( series: a!forEach( items: local!chartDatasubset.data, expression: a!chartSeries( label: fv!item.department, data: fv!item.id_count, /* Clicking on the chart sets the filter value for the grid. */ links: a!dynamicLink(value: fv!item.department, saveInto: local!selectedDepartment) ) ), showWhen: isnull(local!selectedDepartment), colorScheme: "MOSS", style: "DONUT" ) } )
Thanks Ujjwal, I was able to generate the report
If it worked please take a moment to accept the answer so that other people having the same doubt can actually refer and other contributors will know that you have found the solution.