I'm working on a new ACE Study VFE form and trying to push the questions val total to an OBSNOW data display, to push the total to the flowsheet when signed, and to the note text translation.
The val total is working fine - in a data display with connection type MEL expression.
How can I push this total to an OBSNOW? I've tried putting the MEL syntax in the VFE funtion view area, with a data display for OBSNOW on the form, but this isn't working.
Anyone familiar with doing this?
{fn ACESCORE(
val(DOCUMENT.ACE_1)+
val(DOCUMENT.ACE_2)+
val(DOCUMENT.ACE_3)+
val(DOCUMENT.ACE_4)+
val(DOCUMENT.ACE_5)+
val(DOCUMENT.ACE_6)+
val(DOCUMENT.ACE_7)+
val(DOCUMENT.ACE_8)+
val(DOCUMENT.ACE_9)+
val(DOCUMENT.ACE_10))}
{if ACESCORE <> "" then
answer = answer + val(SUB)
endif
endfor
OBSNOW("ACE SCORE", STR(answer))
return ""
}
I sense that something is missing. I see an 'endfor' but where is this loop?
You have made ACESCORE into a function, but I don't see where you are calling it to add the DOCUMENT variables you have placed.
I would make the addition part run when any change is made like so:
{DOCUMENT.ACESCORE //Declare your document variable}
{
DOCUMENT.ACESCORE = val(DOCUMENT.ACE_1) + val(DOCUMENT.ACE_2) +
val(DOCUMENT.ACE_3) + val(DOCUMENT.ACE_4) + val(DOCUMENT.ACE_5) + val(DOCUMENT.ACE_6) + val(DOCUMENT.ACE_7) + val(DOCUMENT.ACE_8) +
val(DOCUMENT.ACE_9) + val(DOCUMENT.ACE_10)
}
And then set DOCUMENT.ACESCORE to your OBSNOW:
{
if (DOCUMENT.ACESCORE <> "") then
OBSNOW("ACE SCORE", DOCUMENT.ACESCORE)
else
""
endif
}
Thanks, this makes sense. But I'm not sure what you mean by declaring the document variable. I am using a data display with a new observation set to ACE SCORE. What do you suggest I do to create the DOCUMENT.ACESCORE variable?
You have to declare DOCUMENT.ACESCORE if it's not attached to something within the form (like a radio button, text box, drop down, etc.)
Yes. This works perfectly now. Thank you!!