I've got several forms I need to change observation terms on, and so our providers don't have to double up on their work, is there a way I can setup a button or something that would pull the info from the old observation terms and write it to the new ones?
Not exactly what you are asking for, but this form entry displays the last value and date, and has a place to enter an new value and date.
I think you might need to create something like this. I am assuming the date will be important.
{!if DURATIONDAYS(LASTOBSDATE("old obs term"), LASTOBSDATE("new obs term")) > 0 then
OBSNOW("new obs term", LASTOBSVALUE("new obs term"), LASTOBSDATE("new obs term"))
else
OBSNOW("new obs term", LASTOBSVALUE("old obs term"), LASTOBSDATE("old obs term"))
endif}
jjordet said:
{!if DURATIONDAYS(LASTOBSDATE("old obs term"), LASTOBSDATE("new obs term")) > 0 then
OBSNOW("new obs term", LASTOBSVALUE("new obs term"), LASTOBSDATE("new obs term"))
else
OBSNOW("new obs term", LASTOBSVALUE("old obs term"), LASTOBSDATE("old obs term"))
endif}
This DOES work, however these terms are tied to a "Insert Previous" button, the clinical list changes show that it did indeed write the correct info to the new term but the button which should put in the previous value doesn't. The boxes are empty despite the button being changed as well. Any thoughts on how to remedy this?
Update: the only way the insert previous works is if I set the fields in the button to the old obs terms…also the field has now somehow become a default previous field. immediately upon opening it displays the last entry, which I do not want
remove the '!' and put the code in your button runprocess.
jjordet said:
remove the '!' and put the code in your button runprocess.
Removing the ! did the trick, I have it in my whiteboard, is that ok?
then you'll have to make it a function and call it from your button.
So the original form I did this on is working great. Duplicating what I did to a new form yields less than desirable results. Everything "works" except the drop down boxes don't populate. The old obs value is written to the new obs value correctly but the box is just empty. Kinda stumped.
I have this in my whiteboard:
{fn Obs1() {if DURATIONDAYS(LASTOBSDATE("CHEM DRUG 1"), LASTOBSDATE("ALLAPGZMED1")) > 0 then
OBSNOW("ALLAPGZMED1", LASTOBSVALUE("ALLAPGZMED1"), LASTOBSDATE("ALLAPGZMED1"))else
OBSNOW("ALLAPGZMED1", LASTOBSVALUE("CHEM DRUG 1"), LASTOBSDATE("CHEM DRUG 1"))endif}}
And this in my run process:
{Obs1()} IF OBSNOW("ALLAPGZMED1") == "" THEN OBSNOW("ALLAPGZMED1", (OBSPREV("ALLAPGZMED1"))) ENDIF
It's identical to the other form, just changed the obs terms. Any thoughts?
I have this in my whiteboard:
{fn Obs1()
{
if DURATIONDAYS(LASTOBSDATE("CHEM DRUG 1"), LASTOBSDATE("ALLAPGZMED1")) > 0 then
OBSNOW("ALLAPGZMED1", LASTOBSVALUE("ALLAPGZMED1"))
else
OBSNOW("ALLAPGZMED1", LASTOBSVALUE("CHEM DRUG 1"))
endif
}
}
And this in my run process:
{Obs1()}
I don't know what you were trying to do with the code after {Obs1()}, but your Obs1 function was setting the obs term with the same date as was last set, not the current obs term value.
jjordet said:
I don't know what you were trying to do with the code after {Obs1()}, but your Obs1 function was setting the obs term with the same date as was last set, not the current obs term value.
It is so when you click the button it "inserts previous"...
but that's what Obs1 is doing...
No. Obs1 is just transferring the data from old obs to new obs. It doesn't insert it into the boxes. If I pull that code out of the working form, nothing inserts in the boxes, putting it back in works like it should. It makes no sense.
Box 1 was CHEM DRUG 1 with a value of Flovent. After clicking my button it should make ALLAPGZMED1 Flovent. Looking at clinical list changes confirms that took place, but why it doesn't show in Box 1 isn't making sense. Box 1 is set to New Observation with ALLAPGZMED1. I don't want it to be New Observation (default previous) because they might not want it to display all the time (this does show correctly though if I put it as such)
Still having issues with this...anyone?