Hello All,
I have a function where I want to give users the option to assign the date that the obs term is inserted in the flowsheet. They are only to add the value once per document. I have added some code to try and catch and reset the value if they make a mistake and need to change the value but it does not seem to be working:
fn fnUpdateStatus(tempStatus,tempProgram,tempDate)
{
//clear first value in case of more than one click
if (OBSNOW("PSCA CCM") <> "") then
OBSNOW("PSCA CCM", "")
else
""
endif
//set value
if (tempDate == "") then
OBSNOW("PSCA CCM", tempStatus)
else
OBSNOW("PSCA CCM", tempStatus, tempDate)
endif
}
In the code above tempStatus is the obs value and tempDate is the date the user has assigned. I have found that if the user selects today's date and then realizes they entered the wrong value everything works as anticipated. The original value is cleared out and the new value is entered. If the user has back dated the obs because the value is associated with a date in the past and then puts in a new value or a new date/value pair the original obs term remains and there are two values in the flowsheet.
It looks like OBSNOW() returns only values with today's date, not values from the current document. Does anyone have any thoughts on how I could fix the code above?
Thanks,
Brad
Please see the attached form we use to load many common items into the flowsheet. It allows for the entry of a value (result) and the date (of transaction). The item is stored when the user clicks on the [Record] button down the right-hand side for the item.
Is this what you are trying to do?
Thank you for the example. That is what I am trying to do. I can get the data entry to work. What I am trying to accomplish is having only one value per obs term. I noticed on your form you have a button to open the "Update Flowsheet" dialog to remove mistakes. What I am trying to do is take care of that step automatically. If the user enters a value and then changes the value I want to remove the first attempt.
With the code above I can get that functionality to work if the date associated with the obs value is the same date as the clinical date of the document. If the user puts in any other date it doesn't work.
For example if you do this (assigning a date in the past):
OBSNOW("WEIGHT", "150","01/01/2020")
And then do this later on:
OBSNOW("WEIGHT") -- what returns is "" per the MEL trace
If you do this:
OBSNOW("WEIGHT", "150")
And then do this later on:
OBSNOW("WEIGHT") -- what returns is "150"
This is why my code is failing... but I'm at a loss on how to pull the last flowsheet value for the current update regardless of date assigned.
Unfortunately, we can no longer leverage dates (or times) other than the document date. If you add an obsterm with a different date, the only method to correct it is to use the flow sheet BUTTON and manually remove it.
Previously, we were able to use a date/time stamp with obsnow. This permitted the workflow you desire and it eliminated the need to have X number of obsterms for serial recordings of values (perfect for Blood Sugars, Peak Flows, B/Ps, etc.), which was a huge thing - HUGE I tell ya! You could see all the recordings down to the minute in the flow sheet view. It was so sweet.
Unfortunately, many did not understand the power they held in their hands. Due to this lack of knowledge, GE was bombarded with bloated database complaints because of the way folks were coding in MEL. Basically, it recorded a new value each time the form AND/or update was opened without the value being changed. It really created a nasty waste of space.
So they took action and removed the date/time stamp argument. Since it was undocumented, they never had to notify anyone either. Just gone... ::wimper::
Lee,
Thank you for the reply. I was afraid of what you described. At least now I won't spend a lot of time trying to find a way to make it work. I'll add a button and a display so the user can fix it through the built in module.
Brad