Need help with formula language date comparisons

Hi there!

I have a web form with the following code in a combobox:

VisitDates:=@DbColumn(“”:“NoCache”;“”:“”;“VisitDates”;1);

@For(i:=1;@Elements(VisitDates);i:=i+1;

@If(VisitDates[i]<@Today; “”; List:=List:@Text(VisitDates[i])));

List

The @DbColumn retrieves a list of dates. I want the @For to loop through those dates and only return the dates that are today or in the future. Past dates should not appear.

This formula always returns “The formula has exceeded the maximum allowable memory usage” on my web page.

Any ideas?

Gérald

Subject: Need help with formula language date comparisons

The condition clause in your @For doesn’t test anything, so the loop never stops. It should be:

@For(i:=1; i<=@Elements(VisitDates); i:= i+1;

I’d be inclined to use @Transform, though – it’s much faster:

Today := @Today;

List := @Transform(VisitDates; “x”; @If(@ToTime(x)<Today; @Nothing; @Text(x)))

Subject: RE: Need help with formula language date comparisons

Thanks, Stan!

I can’t believe I missed that in the @For!

I’ll try your @Transform. I’ve never used it before. Thanks for teaching me something new!

Gérald