Appian Community and Appian Academy are being upgraded. As a part of the upgrade, Appian Community is currently in read-only mode, and user registration is disabled until August 3. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

Generate a Pie chart with expression rule

Certified Senior Developer

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

Parents Reply Children
  • +1
    Certified Lead Developer
    in reply to ujjwalr0002

    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"
        )
      }
    )
    

  • 0
    Certified Senior Developer
    in reply to ujjwalr0002

    Thanks Ujjwal, I was able to generate the report 

  • 0
    Certified Lead Developer
    in reply to p2005

    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.