How to display pie chart between 2 dates?
Discussion posts and replies are publicly visible
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 ) } ),
can you provide full sample code
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
I am getting this error
Interface Definition: Expression evaluation error at function a!queryLogicalExpression [line 16]: The a!queryFilter function has an invalid value for the "value" parameter. When the value of "operator" is ">=" "value" must not be null or empty.
Please pass both the input dates properly in the test input. As I can see the error is because you are not passing one of the date value.
can you provide the code with pie chart field also inclued in it?
I have both the dates in same column
local!data is the data we get from the rule I have given above.
a!pieChartField( label: "", labelPosition: "ABOVE", series: { a!forEach( items: local!data, expression: a!chartSeries(label: local!info[fv!index], data: fv!item.id) ) }, showDataLabels: true, showTooltips: false, showAsPercentage: true, colorScheme: "CLASSIC", style: "DONUT", seriesLabelStyle: "ON_CHART", height: "MEDIUM", refreshAlways: true ),
we need to pass 2 rule inputs in the expression rule with 2 different names
1. start date
2. End date
how to call the local!data