Hi team,
i have an expression rule to get the doctors with count of patients assigned to them with the disease but i want to get the total patience count for that particular doctor with array of disease like eg:
swift:3:{cance,Gallstones,Emotional Disorder}, Please help me to achieve this format
substitute(substitute(substitute(substitute( substitute( substitute( a!queryEntity( entity: cons!PO_MEDICALINFO, query: a!query( logicalexpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "reasonForVisit", operator: "in", value:ri!reasonForVisit ), a!queryFilter( field:"appointmentDate", operator: "between", value: { todatetime(ri!createddatefrom), todatetime(ri!createddateto) }, applywhen: and( not(rule!APN_isEmpty(ri!createddatefrom)), not(rule!APN_isEmpty(ri!createddateto))) ), }, ignorefilterswithemptyvalues: true() ), aggregation: a!queryAggregation( aggregationColumns: { a!queryAggregationColumn( field: "reportingDoctor", isGrouping: true, ), a!queryAggregationColumn( field: "patientId", alias:"patientCount", aggregationFunction:"COUNT" ), a!queryAggregationColumn( field: "reasonForVisit", isGrouping: true ) }, ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: -1, sort: a!sortInfo( field: "patientCount", ascending: true() ) ) ), fetchTotalCount: true ).data,"patientCount",""),"reportingDoctor:",""),",",""),"[",""),"]",""),"reasonForVisit","")
Discussion posts and replies are publicly visible
Likely the answer will be to build a view in the database that displays the data in the appropriate format but the need to output in that very particular text format confuses me. At the very least if that format is required for some reason I'd still output in a CDT and then have a transformation expression rule.
If this hasn't answered your query please provide more details and the expression output of the a!queryEntity()
my requirement is upon giving the doctor name i need to get all the reasons for visit for that particular doctor with a comma separated like eg:{cancer,Gout,fever}. I need to get the reasonfor visit in a array format
When you say "upon giving the doctor name..." - maybe you could pass the doctor name into the Query Entity rule as a filter, then the resulting list would only be visits to that particular doctor, and you could arrange the "reasonForVisit" properties in whatever way you require? Or are you after some sort of enumeration of ALL doctors followed by an array of ALL visit reasons for that doctor, all at once? This is trickier but should be doable.
thank you mike for your reply, can you please give me more description on how to convert the list into array
mamathak0001 You may have to create a View on your PO_MEDICALINFO table using GROUP CONCAT Function as
SELECT reportingDoctor, count(1), GROUP_CONCAT(DISTINCT reasonForVisit SEPARATOR ',') FROM PO_MEDICALINFO
www.mysqltutorial.org/.../
Note: Ensure you are testing this view performance with a considerable amount of data in PO_MEDICALINFO table
thanks you vimalkumars