Hey everyone,
does anyone know how to limit the displayed results of a dynamic listbox to 1 year from the current date? Thanks,
Ken
It depends entirely on how you populate your listbox, if you post your function someone can probably help you add a filter.
I am just very simply using list_obs to populate the listbox:
{list_obs("weight","signed","list","valuedate")}
I just want the listbox to show values in the last 1 year.
sorry i'm using a comma separated list for the dynamic listbox. Right now, this is what I have
{if (DURATIONDAYS(LASTOBSDATE("weight"), str(._TODAYSDATE)) <= 365)
then {list_obs(“weight”,”signed”,”comma”,”valuedate”)}
else ""
endif
}
This obviously doesn't work because it just runs list_obs if they last entered value was under 1 year ago and returns all values. Any help would be greatly appreciated as to how I can just NOT display the items over 1 year old
I didnt test this, but this is the kind of thing i would do
{fn LAST_YEAR_OBS(var){
local hold = getfield(LIST_OBS(var,"signed", "delimited","value"),"|","")
local temp
local rslt = ""
for i = 1, i<=size(hold), i=i+1 do
temp = getfield(hold[i],"^","")
if durationdays(temp[2],str(._TODAYSDATE))<365 then
if rslt "" then
rslt = rslt + ","
endif
rslt = rslt + temp[1] + " (" + temp[2] + ")"
endif
endfor
return rslt
}}{LAST_YEAR_OBS("WEIGHT")}
Thanks so much for your response. It definitely got me pointed in the right direction and I finally figued it out with a bit of tweaking! THANKS!