I'm trying to pull an observation term's values by date into a text component. Here's what I have:
{fn getEchoAll(){TempArray = GETFIELD(LIST_OBS("echofinding", "Signed", "Delimited", "value", FALSE),"^","") return tempArray[2] + " - " + tempArray[1]}}
{getEchoAll()}
This function only pulls the last value instead of ALL of them. Values are delimited by a pipe (|).
Any ideas how I can pull of them? Also, preferably with a blank line between each value.
Thanks!
You're close but not quite there. Contact me directly if you need more information.
/*Retrieve Date/Time*/
{! fn Retrieve_Values()
{
local i=0
local strRet=""
local strArray=""
local arrayValues
strArray=List_Obs("HPI","Pencil","delimited","value")
if strArray<>"" then
arrayValues=getfield(strArray,"|","")
for i=1,i<=size(arrayValues),i=i+1 do
arrayValues[i]=getfield(arrayValues[i],"^","")
strRet=strRet+(if strRet=="","",",")+str(i)+": "+arrayValues[i][2]+" "+arrayValues[i][3]
endfor
endif
document.DateTime=strRet
}
}
You are putting the results from LIST_OBS into an array, but your code is only pulling the second (and possibly the first) record. Jim's code shows you have to loop through each record in the array to pull out the fields that you want to show from each record.