I have a form where I am using a dynamic choice list to show list_obs.
ex: {LIST_OBS("EGFR", "", ",","valuedate")}
Is there a way I can have this only show the last 3 or 4 values instead of it pulling everything for that obsterm?
Something like this could work...instead of using "list", I'm using "delimited" and looping through until I go through the list a specified number of times (in this case 4).
In the form view, the drop-down list MEL expression is {DOCUMENT.LAST_EGFR}
{
!DOCUMENT.LAST_EGFR
}
{
!DOCUMENT.LAST_EGFR = getLast("EGFR", 4)}
}
!fn getLast(o, c)
{
local retStr = ""
local vals = ""
local v1
local v2
cond
case c < 1: /*Do Nothing*/
else:
vals = LIST_OBS(o, "Signed", "delimited","valuedate")
cond
case vals == "": /*Do Nothing*/
else:
v1 = getfield(vals, "|", "")
for x = 1, x <= size(v1), x = x + 1 do
if retStr == "" then
retStr = v1(x)
else
retStr = retStr + "," + v1(x)
endif
if (x + 1) > c then
x = size(v1)
endif
endfor
endcond
endcond
return retStr
}