I am working on a form and I need to set a button to pull in all previous observations after a specific date. The date will be entered on the form.
Can anyone help me with how to make this work?
Here is how I would do it:
ObsArray = getfield(LIST_OBS(obsNameVar,"Signed","Delimited","VALUE"),"|","")
resultStr = ""
for c=1,c<=size(ObsArray),c=c+1 do
ObsArray[c] = getfield(ObsArray[c],"^","")
// this if statement compares the dates from LISTOB to the dateVar. If the Obsterm is older than dateVar, the entire for loop ends.
if DURATIONDAYS(ObsArray[c][2], DateVar) > 0 then
break
else
//if the Obsterm is later than dateVar, add it to the result string.
resultStr = resultStr + ObsArray[c][1] + " on " + ObsArray[c][2] + HRET
endif
endfor
}}
56 on 02/13/2018
56 on 09/16/2016
56 on 05/23/2016
48 on 01/28/2016
48 on 01/25/2016
71 on 11/27/2015
61 on 07/06/2015
60 on 02/03/2015
60 on 01/06/2015
56 on 02/13/2018
Hello,
I like dcarpenter's answer. I also wanted to point out that there appears to be a ccc function that will do something similar. I've been poking around in the ccc files for another project and I found the following functions:
ccc_LV(aa,bb)
ccc_LD(aa,bb)
Here is comment from the ccc_LV function. The CCC_LD function appears to be the same except is returns the date value instead of the obs value:
/* aa is obs heading; bb is duration in days to extract; if bb is empty or does not exist,
then last value will be returned; return last obs value if within date range */
The functions are in the CCC-fndef8.ccc file. I have never used them before, so I can't confirm that they would return what you would want, but I figured I would post this for reference.
Thanks,
Brad