Hi Chuggers,
I am VERY rusty at my VFE building (3 years removed) and just getting back into it. I am trying to create a simple handout that will list the Meds_After and the ALL_After
The tricky part is I need to leave out the Dosage of the meds and the "(critical)" wording in the allergies. I have tried delimiting it but keep getting errors.
Any advice that will trigger my memory?
Thanks in advance!
Amy Roberts
Raleigh Neurology Associates
I use the following in check boxes to pull the list and what fields I want:
{!fn xGrabMeds() {
local temp = getfield(MEDS_AFTER("delimited"), "|", "")
local hold
local rslt =""
for i=1, i<=size(temp),i=i+1 do
hold = getfield(temp[i],"^","")
if hold[1] <> "" then
if rslt <> "" then
rslt = rslt + hret
endif
rslt = rslt + hold[1] + " - " + hold[2] + ","
endif
endfor
return rslt
}}
xGrabMeds() goes into the the variable.
I haven't tried it in a handout though.
Hi Amy,
Welcome back to form building! I get rusty if I take 2 weeks off of coding, so I can imagine what it is like after 3 years! let me give you some general info on delimited items, and we'll see if that solves your errors. if not, post what you have so far, and we can troubleshoot. ^_^ (The community here is great at that)
meds_after("delimited") gives you the details of a med separated by carets '^' and each med separated by bars '|'. you can use the getfield MEL code to break these into an array, and then use a for loop to get the details you want. I will write some code for just showing the name of a med, and the last refill date.
{fn DisplayMeds(){
resultText = ""
medsArray = getfield(meds_after("delimited"),"","|")
for c=1, c<= size(medsArray), c=c+1 do
//create a 2 dimensional array so I can have the details separated for each med
medsArray[c] = getfield(meds_after("delimited"),"","^")
resultText = medsArray[c][1] + " (last refilled on " + medsArray[c][16] + ")"+HRET
endfor
return resultText
}}
this goes at the top of my handout, and then in the section where I want to show the list of all meds, I would type {DisplayMeds()} and the following would display:
LISINOPRIL TABS 100MG (last refilled on 11/12/2017)
HYDROCODONE CAPS 25 MG (last refilled on 11/9/2016)
Please let me know if this helps.
Thank you,
Daniel Carpenter
Thank you both for responding. Here is what I have but I am still getting the dosage and not sure how to fix?
{!fn RETURNMED(){
local RETURNMED = ""
local MEDLIST = getfield(MEDS_AFTER("delimited"),"|","")
local MEDSIZE = size(MEDLIST)
FOR COUNT = 1, COUNT <= MEDSIZE, COUNT = COUNT + 1
do GETMED = getfield(MEDLIST[COUNT],"^","")
RETURNMED = RETURNMED + GETMED[1] +HRET
ENDFOR
RETURNMED}}
I get lost on the 2 dimensional ray part.....And I really appreciate it!! Amy
at:
GETMED[1]
try
GETMED[2]
Field 2 is the generic medication description. I'm guessing the dosage is default with field 1 which is medication description. Not sure if you've stumbled upon it but in help meds_after has the following fields (it may have copy and pasted weird but if you just go into help and look at meds_after you will see this):
medication description
generic medication description
DDID
GPI code
NDC code
Instructions
Removal comments
Start date
Stop date (available only in delimited format)
Stop reason
MID
Medication comments (up to 2000 characters)
Indications—if there are two or more indications for a medication, they are separated by a tilde (~)
Last refill date
Last modified date
adaniel! That was totally it! Thank you for your assistance!
No problem. That function is pretty flexible to for pulling fields out of delimited symbols, just swap out: getfield(this("delimited"), "|", "") with the symbol you'd like to pull info from and change your hold to the fields you would like.