Does anyone know of a way to pull the last obs value if it was signed by any one of a specified list of users.
I know that LASTOBSVALUEBYUSER() will show me the value for whomever is signed in but in this instance the observations will most likely be signed by the provider's medical assistant and then the next form will be opened by the provider under their login.
I hope this makes sense. Thanks for any help!
Use LIST_OBS(), specify "delimited". Fill array with GetField(). Process the array filtering on the desired user in element 4. I know this is just an outline of the approach. If you need help, contact me directly.
Check the specs for list_obs. You could loop through the values and match the user name using nested loops (first loop isolates the obsterm's delimited string, second loop checks for the user's name). If the user name is found, use break to stop the loops (you will need two break statements).
Be certain to limit the obsterm loop count to something like 50 or 100, as that table can get quite large. If you allow it to loop through all results, it may impact performance negatively.
Sample function call:
fnGetUserVals("weight")
Sample function:
{! fn fnGetUserVals(strObs)
{
local retStr = ""
local strTemp = ""
local strTemp2 = ""
local strBuf = ""
local strList = ""
local strUserList = ""
local strCk = ""
local i
local ii
local nMax
strList = List_Obs(strObs,"signed","Delimited","value")
strUserList = "PIPE|Delimited|List|Of|FULL|User|Names"
strTemp = getfield(strList,"|","")
if size(strTemp) < 50 then
nMax = size(strTemp)
else
nMax = 50
endif
for i = 1, i <= nMax, i = i + 1 do
strTemp[i] = getfield(strTemp[i],"^","")
strBuf = strTemp[i][4]
strTemp2 = getfield(strUserList,"|","")
for ii = 1, ii <= size(strTemp2), ii = ii + 1 do
if strTemp2[ii] == strBuf then
strCk = "found"
break
else ""
endif
endfor
if strCk <> "" then
retStr = strTemp[i][1] + "(" + strTemp[i][2] + ")"
break
else ""
endif
endfor
return retStr
}
}
Hope this helps.