I am working on a form that displays the patients vaccines and also allows the user to enter in historical vaccines. The form is working except when you add a historical vaccine it will not update the current display of vaccines unless you re-launch the form. Can someone help me figure out what is missing from my form so it will populate the information as soon as the historical vaccine button is pressed?
This is the call for the vaccine history:
{!fn fnTextTransImmunHxhpv() {
local hold = getfield(IMMUN_GETLIST("Human Papillomavirus", "All"), "|", "")
local temp
local rslt = ""
for i = 1, i <= size(hold), i = i + 1 do
temp = getfield(hold[i], "^", "")
if (rslt <> "") then
rslt = rslt
endif
rslt = rslt + temp[3] + " Vaccine" + " - " + temp[30] + "
"
endfor
return rslt
}}
This is the historical vaccine function:
{!fn fnEnterHPVVax(){
local immunmsg1
local immunmsg2
local immunmsg3
local immunmsg
immunmsg1 = "Human Papillomavirus^Gardasil 9 Intramuscular Suspension^^"
immunmsg2= "^Y^^Y^"
immunmsg3 = "^V01^^^^^^^^^^^^^^^^^^^"
immunmsg4 = "^^^^^^^^^^"
immunmsg = immunmsg1 + obsnow("HPV #2HX") + immunmsg2 + obsnow("HPV") + immunmsg3 + str(obsnow("HPV VAX1HX")) + immunmsg4
result = IMMUN_ADD(immunmsg)
if (result>0) then
USEROK("Historical HPV-9 added")
else
USEROK(result)
endif}}
Thank you,
Andria
The fnTextTransImmunHxhpv() is not set to update when you add a vaccine. You probably have a data display somewhere with a runprocess ste to {fnTextTransImmunHxhpv() }, just change that to
{fnTextTransImmunHxhpv(IMMUN_GETLIST(“Human Papillomavirus”, “All”)) } and it should update.
The function IMMUN_GETLIST() according to the data symbols reference has the ability to evaluate continuously. For these symbols, if you place them inside single curly brackets, any change to the underlying data will force the code the brackets to re-evaluate. If you place them in double brackets inside of a function this does not happen. By passing the IMMUN_GETLIST() as an argument for the function we get this functionality back. Hope that makes sense.
You can further improve the function by using the passed data rather then fetch it again. Data below represents the IMMUN_GETLIST() that you are passing. This also allows you to use the same function for any vaccine and pass just the vaccine you want for each use.
{!fn fnTextTransImmunHxhpv(data) {
local hold = getfield(data,“|”, “”)
local temp
local rslt = “”
for i = 1, i <= size(hold), i = i + 1 do
temp = getfield(hold[i], “^”, “”)
if (rslt <> “”) then
rslt = rslt
endif
rslt = rslt + temp[3] + ” Vaccine” + ” – ” + temp[30] + ”
”
endfor
return rslt
}}
Thank you for that information. It still doesn't seem to work. I will keep trying.