Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting onfirstrecord to give me a 1 1

Status
Not open for further replies.

budoyboy

MIS
Dec 28, 2007
19
0
0
US
if not onfirstrecord then

if previous({ENC_ICU_ADM_VIEW.ACCOUNT_NUMBER}) ={ENC_ICU_ADM_VIEW.ACCOUNT_NUMBER}
and previous({ENC_ICU_ADM_VIEW.DATE_ENTERED_LOCATION}) = {ENC_ICU_ADM_VIEW.DATE_LEFT_LOCATION}

then 0 else 1

I can get a 1 on all the records except the first one so I can get a correct total count
 
Change it to:

if onfirstrecord or
previous({ENC_ICU_ADM_VIEW.ACCOUNT_NUMBER}) <>{ENC_ICU_ADM_VIEW.ACCOUNT_NUMBER} or
previous({ENC_ICU_ADM_VIEW.DATE_ENTERED_LOCATION}) <> {ENC_ICU_ADM_VIEW.DATE_LEFT_LOCATION}
then 1 else
0

-LB
 
if onfirstrecord then 1 else

if (previous({ENC_ICU_ADM_VIEW.ACCOUNT_NUMBER}) ={ENC_ICU_ADM_VIEW.ACCOUNT_NUMBER}
and previous({ENC_ICU_ADM_VIEW.DATE_ENTERED_LOCATION}) = {ENC_ICU_ADM_VIEW.DATE_LEFT_LOCATION})

then 0 else 1

The above code worked sort of. I am getting a 1 for the first record but it is not based on any logic. I want to apply the same "if statement" to the first record as I do to all the others that follow.

 
How can your 'if statement' ever apply to the 1st record when the formula references the previous line?

Are you trying to basically count any instances where duplicate accounts are shown on the next line and the date entered location doesn't match the date left of the previous?

If so I am sure there would be a better way to group and count these occurences.

'J
 
Yes sort of

What I am trying to do is if the account number
is the same i.e. same patient and the DATE ENTERED UNIT =
the DATE LEFT UNIT of the next line then give me a 1.

If the account number of the enxt line match and the DEU and the DLL don't match also give me a 1.

Sometimes a patient can leave a floor and go to another
floor then come back. For these people I want to count
it as another admit to that unit for the month.
 
Please restate what you are trying to count. Your last post says count the patient if the units are the same or if they are different.

-LB
 
The patients are all on the same floor, but different beds sometimes. What happens is that they can go from one bed to another on the same day and these patients should be counted only once. You also have patients that can stay in the same bed their whole stay and they should be counted only once. The tricky ones are those that leave the ICU and go to another floor but then in a day or two or three etc come back to the ICU(their condition worsens). These patients should be counted more than once. You can have 110 patients in the month in the ICU but the correct count for the month is 115. You had 5 patients that left the ICU for one day or greater but then came back.
 
Try:

if onfirstrecord or
previous({ENC_ICU_ADM_VIEW.ACCOUNT_NUMBER}) <>{ENC_ICU_ADM_VIEW.ACCOUNT_NUMBER} or
(
previous({ENC_ICU_ADM_VIEW.ACCOUNT_NUMBER}) ={ENC_ICU_ADM_VIEW.ACCOUNT_NUMBER} and
previous({ENC_ICU_ADM_VIEW.DATE_ENTERED_LOCATION}) <> {ENC_ICU_ADM_VIEW.DATE_LEFT_LOCATION}
)
then 1 else
0

I'm uncomfortable using dates for this though. I think you should explain how the two date fields are used. Shouldn't you really be counting multiple instances of the dateenteredlocation field per patient?

-LB
 
I see what you are saying except patients get moved around i.e. new bed numbers and you get a new date entered. I would be overcounting the number of admits to the unit.
 
I am unclear on whether this is now working for you.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top