What's wrong with my formula?

Hi there!

I’m using this formula to populate a combobox with the list of years from 1970 to this year plus 1 in descending order, but it only returns the number 1.

@For(i:=@Sum(@ToNumber(@Year(@Today):1));i>=1970;i:=i-1;@Text(i))

Any help would be appreciated.

Thanks!

Gérald

Subject: What’s wrong with my formula?

First, you’re not actually building a list. Second, you’re returning the value of the @For statement as a whole (which is 1 if there’s no error within the loop), not anything that happens inside it. What you need to do is build a list inside the loop and return that value:

@For(i:=@Sum(@ToNumber(@Year(@Today):1));i>=1970;i:=i-1;YearList := YearList:@Text(i));

YearList

Subject: RE: What’s wrong with my formula?

Thank you for your prompt response.

Have a great weekend.

Gérald