Can someone tell me how to create a dynamic medication list? I have a form that uses a dynamic problem list and I tried to sort of copy that language but it doesn't work correctly. I just want the medication name.
I was able to get one function to work but it sort of brought in way too much like instructions, last refill date, person that refilled, etc.
Thanks for any help.
Here's the code I use. I'm certain I didn't write this, so my apologies if it looks familiar to anyone who isn't being credited:
/*
Function to populate dynamic choice list of medications.
*/
!fn fnMedList(strList)
{
local lCounter
local MedArray
local lBuffer
local strFormattedList = ""
MedArray = getfield(strList, "|", "")
for lCounter = 1, lCounter <= size(MedArray), lCounter = lCounter + 1 do
MedArray[lCounter] = getfield(MedArray[lCounter], "^", "")
/* Need to remove commas from medication name */
lBuffer = tolower(MedArray[lCounter][1])
lBuffer = set(lBuffer, 1, toupper(get(lBuffer, 1))) + " " + MedArray[lCounter][7]
lBuffer = ReplaceStr(lBuffer, ",", ";")
strFormattedList = strFormattedList + lBuffer + ","
endfor
if (lCounter > 1) then
strFormattedList = remove(strFormattedList, size(strFormattedList))
endif
return (strFormattedList)
}
this is called as:
{fnMedList(MEDS_AFTER("delimited"))}