I'm going to try to explain this best I can. I need to pull obs much like the OB-flowsheet-CCC does as we have found ourselves needing more customization out of it. I have code to pull a set amount but the following isn't quite what I think I need to mimic the ob-flowsheet-CCC.
{!fn getOldObs1(){
local oblist = ""
local listob = ""
local max = 3
local count = 1
local parts = ""
local num_obs = 0
oblist = getfield(LIST_OBS('WEIGHT','SIGNED','DELIMITED','VALUEDATE'),"|","")
num_obs = size(oblist)
if num_obs <3 then
max = num_obs
endif
if oblist <> "" then
while count <= max do
parts = getfield(oblist[count],"^","")
if count < max then
listob = listob + parts[1] + ", "
else
listob = listob + parts[1] + hret
endif
count = count + 1
endwhile
return listob
endif
}}
I have two approaches below. Although unsure what you are trying to create.
aa
{LIST_OBS("LDL","signed","data","valuedate")}
bb
{LIST_OBS("LDL","signed","list","valuedate")}
cc
producing (note the aa,bb,cc to separate):
aa
136 (04/02/2018 8:44:54 AM), 4 (08/04/2016 9:38:15 AM), 95 (08/10/2015 1:22:29 PM), 125 (08/19/2013 11:18:57 AM).
bb
136 (04/02/2018 8:44:54 AM)
4 (08/04/2016 9:38:15 AM)
95 (08/10/2015 1:22:29 PM)
125 (08/19/2013 11:18:57 AM)
or, try
{local sA1, a1, a2=0, a3="", s1="", i=0, imax=0, j=1
sA1 = getfield(LIST_OBS("LDL","signed","list","valuedate"),")",HRET)
if size(sA1)<=10 then imax = size(sA1) else imax = 10 endif
s1=""
for i=1,i<imax,i=i+1 do
a1 = getfield(str(sA1[i])," ","")
a1[2] = sub(a1[2],2)
s1 = s1 + a1[2] + ", " + a1[1] + HRET
endfor
s1}
producing:
04/02/2018, 136
08/04/2016, 4
08/10/2015, 95
08/19/2013, 125
Yep! I can get to where I need to go with this. Thanks again.