SNTT : Don’t hard code your Selectedable Years in a Lotus Notes dialog box.

Hard coding is bad, bad , bad. Very bad, okay? (see Avoiding Hard Coding of Group Names).

Here’s a quick and dirty way to have a drop down dialog which selects the “Year” and not be hard coded.

1
2
3
4
currentYear := @Year(@Now );
@Text(currentYear-1) :
@Text(currentYear) :
@Text(currentYear+1)

which results in a multip value list of (for this year) “2008” : “2009” : “2010”

and then make the default value

1
@Text(@Year(@Now ))

and, of course, you could easily extended this forward or back additional year values if needed.

One thought on “SNTT : Don’t hard code your Selectedable Years in a Lotus Notes dialog box.

  1. One step further (as I was bored and just browsing Notes coding tips):

    currentyear:= @Year(@Now);
    yearlist := @Text(currentyear);
    numofyears := 50;
    direction := -1;
    @For(n:=1;
    n <= numofyears;
    n:=n+1;
    yearlist := yearlist:@Text(currentyear + (direction*n))
    );

    Cheers,
    Phil

Leave a Reply