< Back

Document Subject: Get a list of years the easy way using permuted operator
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#permuted or http://A555F9/nn.nsf/ByAlias/permuted

Revisiting my web date picker, it allows the year to be selected froma pull down. I extended this to go back 70 years for date of births. The Notes client date picker is rubbish at this, as it only goes back 3 years, maybe I will rewrite this picker so it works in the client as well.... Anyway how to supply to the user a list of years from 1938 to this year.




So basically I need a list fo numbers to put in my drop down formula.

I can put in

1948:1949 .... 2008

but this will nedd updating every year. Painful.

 

I can do something like:

y:=@Year(@Today);
(y-60):(y-59)

...
(y-5):(y-4):(y-3):(y-2):(y-1):

y:

(y+1)

which is ugly

I could do a for loop:

@For(n := @Year(@Today)-70;
n <= @Year(@Today)+10;
n:=n+1;
FIELD yrs:=yrs:@Text(n)
);
@Trim(yrs)

but it needs to work with notes 5, and @for only came in notes 6.

or I could use permuted operators.

Proper functional language.

d:="196":"197":"198":"199":"200":"201"
yu:="0":"1":"2":"3":"4":"5":"6":"7":"8":"9"
d*+y

or even:

y:=@Integer(@Year(@Today)/10);

d:=(y-7):(y-6):(y-5):(y-4):(y-3):(y-2):(y-1):(y):(y+1);
yu:=@Text(0:1:2:3:4:5:6:7:8:9);
@Text(d)*+yu

 

- very nice

So next time you need a list of numbers (or strings), try permuted operators.

For Example: You could do a date one that gives Jan 1930 to Dec 2018....