Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: USE FORMULA IN GROUP OR SORT Post Reply Post New Topic
Author Message
Sharmtow1
Newbie
Newbie


Joined: 25 Mar 2019
Location: United States
Online Status: Offline
Posts: 1
Quote Sharmtow1 Replybullet Topic: USE FORMULA IN GROUP OR SORT
    Posted: 26 Mar 2019 at 1:41am
I have a formula which defines the patient type. a patients patient type is defined by 1- if they are in ICU, 2- if they have specific type of line. 3- if they do hot have a cl or in ICU.
the following formula is used to get the patient type

IF {Command.DEPARTMENT_ID} IN [2133009,4313023,4313015,4313016,4314007,4314009,4314027,5119219,5119221,5115578,73,5115579,5119222,5123216,
5133207,5119223,5101202,5133026,5119220,5120202,5119218,5119235] THEN 'CHG'
ELSE
IF NOT ISNULL({Command.IP_LDA_ID_A}) THEN Minimum ({Command.PATIENT_TYPE}, {Command.Y_MRN})
ELSE
{Command.RM_PATIENT_TYPE}

the above formula is used in a compliance formula below

IF {Command.BATH_STATUS}='NOT DOCUMENTED' THEN 'NO'
else
IF {@PATIENT TYPE}='STANDARD' AND {Command.BATH_STATUS}='WASHED / GIVEN'
AND ISNULL({Command.STANDARD_BATH})THEN 'NO'
ELSE
IF {Command.BATH_STATUS}='Refused' THEN 'N/A'
ELSE
IF {Command.MEAS_VALUE} LIKE '*Refuse*' THEN 'N/A'
ELSE
IF {Command.MEAS_VALUE} LIKE '*Contrain*' THEN 'N/A'
ELSE
IF {Command.BATH_STATUS}='NOT DOCUMENTED' THEN 'NO'
ELSE
IF {Command.BATH_STATUS}='NOT GIVEN' THEN 'NO'
ELSE
IF {Command.MEAS_VALUE} LIKE '*Incontinence care*' THEN 'NO'
ELSE
IF {Command.MEAS_VALUE} LIKE '*Independent*' THEN 'YES'
ELSE
IF {Command.MEAS_VALUE} = 'NOT GIVEN' THEN 'NO'
ELSE
IF{@PATIENT TYPE}='STANDARD' AND {Command.BATH_STATUS}='WASHED / GIVEN'
AND {Command.STANDARD_BATH} ='Standard bathing wipes' THEN 'YES'
ELSE
IF{@PATIENT TYPE}='STANDARD' AND {Command.BATH_STATUS}='WASHED / GIVEN' AND NOT ISNULL({Command.STANDARD_BATH})THEN 'YES'
ELSE
IF{@PATIENT TYPE}='STANDARD' AND {Command.BATH_STATUS}='WASHED / GIVEN' AND NOT ISNULL({Command.STANDARD_BATH})
AND NOT ISNULL({Command.CHG})THEN 'YES'
ELSE
IF{@PATIENT TYPE}='STANDARD' AND {Command.BATH_STATUS}='WASHED / GIVEN' AND NOT ISNULL({Command.STANDARD_BATH})
AND ISNULL({Command.CHG})THEN 'YES'
ELSE
IF{@PATIENT TYPE}='CHG' AND {Command.BATH_STATUS}='WASHED / GIVEN' AND NOT ISNULL({Command.STANDARD_BATH})
AND NOT ISNULL({Command.CHG})THEN 'YES'
ELSE
IF{@PATIENT TYPE}='CHG' AND {Command.BATH_STATUS}='WASHED / GIVEN' AND NOT ISNULL({Command.CHG})THEN 'YES'
ELSE
IF{@PATIENT TYPE}='STANDARD' AND {Command.BATH_STATUS}='WASHED / GIVEN' AND ISNULL({Command.STANDARD_BATH}) THEN 'NO'
ELSE
IF{@PATIENT TYPE}='CHG' AND {Command.BATH_STATUS}='WASHED / GIVEN' AND {Command.STANDARD_BATH} ='Standard bathing wipes'
AND ISNULL({Command.CHG}) THEN 'NO'
ELSE
IF{@PATIENT TYPE}='STANDARD' AND {Command.BATH_STATUS}='WASHED / GIVEN'
AND ISNULL({Command.STANDARD_BATH}) THEN 'NO'

i am trying to sort or group on the above formula but i get the following error

GROUP SPECIFIED ON NON RECURRING FIELD.

any idea how to correct this so i can group on it?
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 26 Mar 2019 at 4:05am
The problem is that in the  patient type formula, you have a minimum function. You cannot group on a formula that contains an aggregate.  The only solution I know of is put the 'formula' in a SQL statement (probably a command.  I have not tried this myself.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.