I am trying to accomplish the following:
Group report by Patients with '1 Emergency Visit Only','2 to 5 Emergency Visits', or 'More than 5 Emergency Visits'.
I thought I could use the following SQL Expression to count:
and a Formula to Group:
If I put these two on the report, they display as expected. However they do not group as expected; everything is grouped in '1 Visit Only'.
I imagine it has something to do with when the expression is processed vs when the grouping happens/is printed and I need to be clued in on how to fix, or maybe there is a better approach to this grouping?
Crystal Reports 2008
Group report by Patients with '1 Emergency Visit Only','2 to 5 Emergency Visits', or 'More than 5 Emergency Visits'.
I thought I could use the following SQL Expression to count:
SQL:
COUNT("PAT_ENC_HSP"."ED_EPISODE_ID") OVER (PARTITION BY "PAT_ENC_HSP"."PAT_ID")
and a Formula to Group:
Code:
if {%Number of Visits} = 1 then "1 Visit Only"
else if {%Number of Visits} in 2 to 5 then "2 to 5 Visits"
else if {%Number of Visits} > 5 then "More than 5 Visits"
else "*Unknown Number of Visits"
If I put these two on the report, they display as expected. However they do not group as expected; everything is grouped in '1 Visit Only'.
I imagine it has something to do with when the expression is processed vs when the grouping happens/is printed and I need to be clued in on how to fix, or maybe there is a better approach to this grouping?
Crystal Reports 2008