I have a requirement where i need to filter values according to date but the field in CDT is given as date and time field.
For Eg: bookingDate in CDT is the date and time field. But, when I filter the data in the expression rule , I need to get data based on booking date only not time. ( For eg: I need to get the number of people who booked the tickets for the day but i dont want according to date and time I just want the count for the particular entire day). Can anyone please help me to solve this!
Thank you in advance.
Discussion posts and replies are publicly visible
Hi,
This might help you, but please do test it out thoroughly:
a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "bookingDate", operator: ">=", value: todatetime(today()) ), a!queryFilter( field: "bookingDate", operator: "<", value: todatetime(today() + 1) ) } )
Thank you for your reply. I actually tried in this way but it give me the data only for today, but i want like: whichever date I click/select i need to get that day all booking details
Yes, instead of today() function, if you pass your respective variable, it will work as expected.
No , it is actually showing me complete data , it is not showing me according to a particular date
Can you post screenshots / examples of what you did? The post by Selvakumar should work for what you need.
I am getting all the 55 items when I select a date
What is the operator in your logical expression? Can you please paste the whole code using the Insert code option?
a!localVariables( a!queryEntity( entity: cons!PO_MEDICALINFO, query: a!query( aggregation: a!queryAggregation( aggregationColumns: { a!queryAggregationColumn( field: "reportingDoctor", isGrouping: true ), a!queryAggregationColumn( field: "patientId", alias:"patientCount", aggregationFunction:"COUNT" ), a!queryAggregationColumn( field: "reasonForVisit", isGrouping: true ), a!queryAggregationColumn( field: "appointmentDate", isGrouping: true ) } ), logicalexpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "reasonForVisit", operator: "=", value:ri!reasonForVisit, ), a!queryFilter( field: "appointmentDate", operator: ">=", value: todatetime((ri!appointmentDate)) ), a!queryFilter( field: "appointmentDate", operator: "<", value: todatetime(ri!appointmentDate + 1) ), a!queryFilter( field: "reportingDoctor", operator: "=", value:ri!reportingDoctor ), }, ignorefilterswithemptyvalues: true() ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: -1 ) ), fetchTotalCount: true ).data, )
AND Operator is used in my logical expression