Skip to main content
January 3, 2023
Question

Pie Chart

  • January 3, 2023
  • 10 replies
  • 0 views

How to display pie chart between 2 dates?

    10 replies

    January 3, 2023

    Hi, Please use this kind of filters in the query to fetch the data between 2 dates and then use the output data in the piechart.

    
        logicalExpression: a!queryLogicalExpression(
          operator: "AND",
          filters: {
            a!queryFilter(
              field: "startDate",
              operator: ">=",
              value: ri!backDate
            ),
            a!queryFilter(
              field: "startDate",
              operator: "<=",
              value: ri!date
            )
          }
        ),
       

    January 3, 2023

    can you provide full sample code

    January 3, 2023

    Here is the full code for your reference.

    a!queryEntity(
      entity: /* PASS YOUR DATASTORE ENTITY CONSTANT*/,
      query: a!query(
        aggregation: a!queryAggregation(
          aggregationColumns: {
            a!queryAggregationColumn(
              field: "Surveyid",
              isGrouping: true
            ),
            a!queryAggregationColumn(
              field: "id",
              aggregationFunction: "COUNT"
            )
          }
        ),
        logicalExpression: a!queryLogicalExpression(
          operator: "AND",
          filters: {
            a!queryFilter(
              field: "startDate",
              operator: ">=",
              value: ri!backDate
            ),
            a!queryFilter(
              field: "startDate",
              operator: "<=",
              value: ri!date
            )
          }
        ),
        pagingInfo: a!pagingInfo(
          1,
          - 1
        )
      )
    ).data