Does anyone know if you can pull the comments field from the medication update into the list? We have the med, dose, and instructions, but would like to also display the comments into a handout. We use that field for the reason the patient is on the medicine.
You may use meds_new("delimited"), meds_after("delimited") or meds_prior("delimited"). the last parameter for these is the comments. Here's a snippet from the symbol help for meds_after:
Can I use MEDS_AFTER("list") and get the comments? I can't seem to get it to work. I don't want all the other info that comes with delimited. What I have currently is:
{ReplaceStr(MEDS_AFTER("list"), hret, hret)}
No, unfortunately the comments are not returned with the "list" arguement. You'll have to use a function and return the array elements you want. Here's a simple example. There are many ways to do this and you can certainly format it differently, but this will return the med name, instructions, and the comment (if any) for a data display. If you need a listbox or dropdown result, then change the hret to a comma. Place the function in the fn pane, and place this call on the form item. Be sure to copy/paste this to notepad first, then to VFE.
//call for item
{meds_cmt(meds_after("delimited))}
//place in function pane
{fn meds_cmt(meds){
if meds == "" then return "No medications recorded." else "" endif
local n, arrMeds, result=""
arrMeds=sort(getfield(meds, "|",""))
for n=1, n<=size(arrMeds), n=n+1 do
arrMeds[n]=getfield(arrMeds[n], "^","")
if result <> "" then result=result + hret + arrMeds[n][1] + " -- " + arrMeds[n][7] + (if arrMeds[n][14] <> "" then " - " + arrMeds[n][14] else "" endif) else result = arrMeds[n][1] + " -- " + arrMeds[n][7] + (if arrMeds[n][14] <> "" then " - " + arrMeds[n][14] else "" endif) endif
endfor
return result}}
Sorry, left a end quote in the call:
{meds_cmt(meds_after("delimited"))}
Would this work for a handout? We are trying to include this in the handout the patient gets. Or would the handout have to be generated by a vfe form?
Yes, you could do that. Copy/paste the function to notepad, remove extra lines and line feeds, then place the function itself at the top of the letter before any other text in the letter, and then place the call where you want the list to appear. It might look like this:
{fn meds_cmt(meds){if meds == "" then return "No medications recorded." else "" endif local n, arrMeds, result="" arrMeds=sort(getfield(meds, "|",""))
for n=1, n<=size(arrMeds), n=n+1 do arrMeds[n]=getfield(arrMeds[n], "^","")if result <> "" then result=result + hret + arrMeds[n][1] + " -- " + arrMeds[n][7] + (if arrMeds[n][14] <> "" then " - " + arrMeds[n][14] else "" endif) else result = arrMeds[n][1] + " -- " + arrMeds[n][7] + (if arrMeds[n][14] <> "" then " - " + arrMeds[n][14] else "" endif) endif endfor return result}}
Meds: {meds_cmt(meds_after("delimited"))}
That got me closer. Do you know why it would put a " '96 " or " '97 " between the medication, instructions, and comments?
Also, my extra space in between the lines was lost "hret, hret"
Please contact me directly so we can resolve this.
Paul Atkinson, M.S.
Senior Informatics Consultant
Community Health Network
7155 Shadeland Station
Indianapolis, IN 46256
Phone: 317.621.2885
Fax: 317.621.7609
Mobile: 317.714.2652
[email protected]