Hello,
I am new with MEL and I am trying to build a form and within that form I want to pull medications by medication class. I have used a function that I had gotten from here in letters and history views but it will not work with VFE. Does anyone have a MEL function that will pull medications by Med Class?
Hello, I created a handout that uses a function to pull in active meds if they fit in a specified GPI Class based on this resource http://www.hebrewseniorlife.or.....edLIST.pdf
and format them into a sort of questionaire, here is the code. It should work in a form too, maybe some of it will be useful.
{fn GetMedsByClassHandout(med_class, num){
local rets = ""
local hold = ""
local togo = 0
local total = 50
local detstr3 = ""
local meds_array = getfield(MEDS_AFTER("delimited"), "|", "")
local detstr = "Last Dose:_____________________________" + hret + " " + " (DATE) (TIME)" + hret +
"Prescription Instructions:"
local detstr2 = hret + hret +
"How are you taking this medication:______________________________________________________" + hret + hret + hret
for i = 1, i <= size(meds_array), i = i + 1 do
local med_array = getfield(meds_array[i], "^", "")
if (ok(med_array[4])) then
if (med_array[4] <> "") then
if match(med_class,sub(med_array[4], 1, num))>0 then
rets = rets + FMT(med_array[1],"B")
togo = total - size(med_array[1])
if togo>0 then
for j = 1, j <=togo, j = j + 1 do
hold = hold + " "
endfor
endif
if med_array[7] <> "" then
detstr3 = sub(med_array[7] + " ",1,63)
else
detstr3 = " "
endif
rets = rets + hold + detstr + FMT(detstr3,"B,U") + detstr2 + HRET
hold = ""
endif
endif
endif
endfor
if (rets == "") then
rets = "No medications available"
else
rets = rets + "Notes: __________________________________________________________________________________" + + hret + hret + "_________________________________________________________________________________________" + hret + "\n\r\n\r\tPatient Signature:___________________________________________"
endif
return rets
}}{GetMedsByClassHandout("57^58^59^60^61^62^63^64^65^66^67^68^69^70^71^72^73^74^75^76",2)}
I am using the following with the above resource to correctly list the med class by GPI Classification:
{fn GetMedsByClass(med_class, num, update) { local rets = "" local meds_array = getfield(MEDS_AFTER("delimited"), "|", "") for i = 1, i <= size(meds_array), i = i + 1 do local med_array = getfield(meds_array[i], "^", "") if (ok(med_array[4])) then if (med_array[4] <> "") then if (sub(med_array[4], 1, num) == med_class) then rets = rets + med_array[1] + HRET else continue endif else continue endif else continue endif endfor if (rets == "") then rets = "None" endif return rets }}{FMT("Antihypertensive Medications", "B,U,2") + HRET +FMT(GetMedsByClass("36", 2), "")}
The 2 items listed in RED are the only thing I change. I list the name of the category of med in the first section (this acts as the header) and then the number of the category in the second section and it pulls within letters, handouts, etc! I hope this helps!
Sirna said:
I am using the following with the above resource to correctly list the med class by GPI Classification:
{fn GetMedsByClass(med_class, num, update) { local rets = "" local meds_array = getfield(MEDS_AFTER("delimited"), "|", "") for i = 1, i <= size(meds_array), i = i + 1 do local med_array = getfield(meds_array[i], "^", "") if (ok(med_array[4])) then if (med_array[4] <> "") then if (sub(med_array[4], 1, num) == med_class) then rets = rets + med_array[1] + HRET else continue endif else continue endif else continue endif endfor if (rets == "") then rets = "None" endif return rets }}{FMT("Antihypertensive Medications", "B,U,2") + HRET +FMT(GetMedsByClass("36", 2), "")}
The 2 items listed in RED are the only thing I change. I list the name of the category of med in the first section (this acts as the header) and then the number of the category in the second section and it pulls within letters, handouts, etc! I hope this helps!
Sirna,
This is the same function I have but I can NOT get it to work on my form. It works on my History views and my handouts but just not taking on my form.