Here's the piece I need to sort
{!fn fnUser() {
local temp = getfield(GET_USER_LIST ("PHYSICIA", "", "delimited"), "|", "")
temp = sort(temp,TRUE)
local hold
local rslt =""
for i=1, i<=size(temp),i=i+1 do
hold = getfield(temp[i],"^","")
if hold[1] <> "" and hold[6] == "Physician (MD, DO)" then
if rslt <> "" then
rslt = rslt + hret
endif
rslt = rslt + ReplaceStr(hold[2], ",", "\,") + " " + hold[9] + ","
endif
endfor
return rslt
}}
This works until about 4 down then it's back to scrambled. I'm not sure where else I could put the sort or if i'm even putting it in the correct place. I don't have much experience using it. The data im pulling is the users search name and their NPI if they have the title of Physician (MD, DO).
EDIT: I beleleive the sort is happening at the login name which is the first field, so I need to get it to sort by the second field, the search name.
Change rslt to an array, and for each result, push the result into the array like
insert(rslt,1,ReplaceStr(hold[2], “,”, “\,”) + ” ” + hold[9])
then return sort(rslt, TRUE) at the end