Hello
I am trying to figure out how to populate Pharmacy demographics into a letter. I used
{REGPHARMACY()} but it only gives me the Pharmacy name.
Thanks
Laurie
Try this function
{fn get_pharmacies() {local a,c local i = getRowCount('Business') while i > 0 do i = i-1 a = getRow('Business',i,'searchName','Address1','Address2','City','State','Zip','primPhone','ISPHARMACY') if a[1] <> "" and a[8] ="Y" then c=c+"|" + a[1] + " - " + a[2] + "" + a[3] + " " + a[4] + ", " + a[5] + " " + a[6] + " " + a[7] + HRET else "" endif endwhile if c=="" then return "None entered" else "" endif local result=sort(getfield(c,"|","")) local arr_size=size(result) for a=1, a<arr_size, a=a+1 do if result[a]==result[a+1] then remove(result,a+1) arr_size=arr_size-1 else "" endif endfor local result1 = str(result) result1 = replacestr(result1,",","") return str(result1) }} {get_pharmacies()}
We did find a bug in this though and have contacted GE. getRowCount('Business') sometimes returns 0 rows even if there is a pharmacy in the patient's contacts but if you go to Registration, after that it will return the correct number of rows.
DavidShower said:
Try this function
Thanks David
I keep getting "none entered" I tried going into Reg and tried the function again but it still comes up "none entered"
Laurie
We did find a bug in this though and have contacted GE. getRowCount('Business') sometimes returns 0 rows even if there is a pharmacy in the patient's contacts but if you go to Registration, after that it will return the correct number of rows.
I checked the code and it does work in our environment - EMR 9.5 patch 1. You might do a mel trace and take a look. If you want to send it to me I'd be happy to look at it.
DavidShower said:
I checked the code and it does work in our environment - EMR 9.5 patch 1. You might do a mel trace and take a look. If you want to send it to me I'd be happy to look at it.
I'll try the MEL trace first, if that doesn't help me then I will send it to you. Thanks
Laurie
Sorry, I did get a reply back from GE on this. The function needs to be updated to hit the person table so that the pharmacy info will always pull back. We had earlier dropped the info from the handout so I haven't done anything to update it. It was our SR 1-273621013.
David Shower
We are on 9.5, but here is the function I wrote to return the address from the Pharmacies object using the REGPHARMACY symbol.
Hope this meets your needs.
{ fn REGPHARMACY_ADDRESS(){ local strBuffer="" local Address1="" local Address2="" local City="" local State="" local Zip="" //QUERY PHARMACIES OBJECT **meldefs8.txt** Address1=find("Pharmacies","Address1","ListName",REGPHARMACY()) Address2=find("Pharmacies","Address2","ListName",REGPHARMACY()) City=find("Pharmacies","City","ListName",REGPHARMACY()) State=find("Pharmacies","State","ListName",REGPHARMACY()) Zip=find("Pharmacies","Zip","ListName",REGPHARMACY()) strBuffer= Address1 + HRET if (Address2 == "") then else strBuffer=strBuffer + Address2 + HRET endif strBuffer=strBuffer + City + ", " + State + " " + Zip return strBuffer }