I want to pre-populate referral information when the referral order is selected.
I have drop down list of all active referral using following MEL function
str(getfield(ORDERS_AFTER("LIST","R") ,"\n",",\r"))
Now is there a way to populate
1. ordering provider
2. ordered date
3. diagnosis
etc associated with the referral that is selected.
Thank you
Ayush
You will need to call ORDERS_AFTER("delimited","R"). Put the information it returns in an array and loop through it until you match on the order selected and then pull the information you need. Check the help on ORDERS_AFTER for the fields available and what order they appear in.
DavidShower said:
You will need to call ORDERS_AFTER("delimited","R"). Put the information it returns in an array and loop through it until you match on the order selected and then pull the information you need. Check the help on ORDERS_AFTER for the fields available and what order they appear in.
Thank you David,
i will try it
-- to setup referral in drop down list fn fnorders() {getfield(ORDERS_AFTER("LIST","R") ,"\n",",\r")} -- to chose provider {fn fnprov()
{getfield(ORDERS_AFTER("delim","r"),"|","") for i = 1, i < size(vref), i = i + 1 do vref[i] = getfield(vref[i],"^","") endfor vref[i][21] }}
How can i set the value of "i" according to what is chosen in the referral drop down list?
I would set the drop-down to a document variable and then pass the document variable as a parameter. So you would call it like this: fnprov(document.orderchosen) And your function would start like this In your do loop you need to match the the description field from vref (looks like field 1) to the description you passed in with document.orderchosen/strOrder. I think you will end up with something like this though no warranty is provided for this dashed out code /grin : {fn fnprov(strOrder) {vref = getfield(ORDERS_AFTER("delim","r"),"|","") for i = 1, i < size(vref), i = i + 1 do strReferral = getfield(vref[i],"^","") if match(strReferral[1],strOrder) > 0 then set all your obs terms or varialbles here with fields from strReferral else endif endfor }}
{fn FnRef() {getfield(orders_after("list","r"),"\n",",\r")}} call FnRef() in dropdown document.ref
{ fn FnOrderInfo(num) { global StrOrder = document.ref global StrRef_Line = getfield(orders_after("delim","r"),"|","") for a = 1,a<=size(StrRef_Line),a=a+1 do if (match(StrRef_Line[a],1,StrOrder)) then global StrRef_Item = getfield(StRref_Line[a],"^","") break endif endfor StrRef_Item[num] }}
Using data display --> mel expression to call fnorderinfo(21)
//21 - for provider name
thank you for all the help so far. new to mel programming and got no training either.
no errors but no data displayed.
Thank you again