Hello I am working on a form and I would like to pull from the active medication list in a drop down all the Asthma medications with the instructions. Does any one have a function for this. I am not really good with functions and I have one but it does not bring in the instructions in the drop down. Any help would be greatly appreciated!
If you have a function that does that much, share it here and it may be quicker for someone to point out a modification. For instance, you may need to simply append another field from the med list array.
This should get you close, instructions would be field 6 or 7 I think if you wanted to add it
{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
}}
Hello,
Thank you I didn't post the function I have because I really don't understand it but I will post it. It was built in a form someone else built.
{!fn fnMedsDropdown(strList)
{
local lCounter
local strMedicationList
local strBuf
local strFormattedList = ""
strMedicationList = getfield(strList, "|", "")
for lCounter = 1, lCounter <= size(strMedicationList), lCounter = lCounter + 1 do
strMedicationList[lCounter] = getfield(strMedicationList[lCounter], "^", "")
/* strFormattedList = strFormattedList + fnConvertMedicationTypeToString(strMedicationList[lCounter][1], FALSE) /* Number and prefix */
/* Need to remove commas from medication name */
strBuf = strMedicationList[lCounter][1]
strBuf = ReplaceStr(strBuf, ",", "\,")
cond
case
match(strMedicationList[lCounter][4],"2210") > 0 OR
match(strMedicationList[lCounter][4],"4110") > 0 OR
match(strMedicationList[lCounter][4],"4120") > 0 OR
match(strMedicationList[lCounter][4],"4155") > 0 OR
match(strMedicationList[lCounter][4],"4199") > 0 OR
match(strMedicationList[lCounter][4],"4210") > 0 OR
match(strMedicationList[lCounter][4],"4220") > 0 OR
match(strMedicationList[lCounter][4],"4230") > 0 OR
match(strMedicationList[lCounter][4],"4240") > 0 OR
match(strMedicationList[lCounter][4],"4399") > 0 OR
match(strMedicationList[lCounter][4],"4410") > 0 OR
match(strMedicationList[lCounter][4],"4415") > 0 OR
match(strMedicationList[lCounter][4],"4420") > 0 OR
match(strMedicationList[lCounter][4],"4430") > 0 OR
match(strMedicationList[lCounter][4],"4440") > 0 OR
match(strMedicationList[lCounter][4],"4450") > 0 OR
match(strMedicationList[lCounter][4],"4460") > 0 OR
match(strMedicationList[lCounter][4],"4499") > 0 OR
match(strMedicationList[lCounter][4],"5216") > 0 OR
match(strMedicationList[lCounter][4],"5720") > 0 OR
match(strMedicationList[lCounter][4],"6030") > 0 OR
match(strMedicationList[lCounter][4],"6499") > 0 OR
match(strMedicationList[lCounter][4],"8630") > 0 OR
match(strMedicationList[lCounter][4],"8680") > 0 OR
match(strMedicationList[lCounter][4],"8825") > 0 OR
match(strMedicationList[lCounter][4],"9015") > 0 OR
match(strMedicationList[lCounter][4],"9020") > 0 OR
match(strMedicationList[lCounter][4],"9055") > 0
/* strFormattedList = strFormattedList + strBuf + " (" + strMedicationList[lCounter][3] + ")" + "," */
strFormattedList = strFormattedList + strBuf + " (" + strMedicationList[lCounter][2] + ")" + ","
endcond
endfor
if (lCounter > 1) then
strFormattedList = remove(strFormattedList, size(strFormattedList))
endif
return strFormattedList
}
It works good but does not bring in the instructions for the medication.
**Gibsonmi I will try this and play around with it . It seems a little simpler than the one I currently have.
Thanks a bunch!