Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Enter the current year via some script?

Can this be accomplished by having the current determined by SSI script or PERL rather than entering the the current year manually?
related to an answer for: validate age in numeric questions
asked Oct 16, 2019 by Chris Guth Bronze (985 points)

1 Answer

0 votes
Sure.  This code should return the current year:

[% Begin Unverified Perl
my @now = localtime();
return 1900 + $now[5];
End Unverified %]


If you need to do some additional math to the year like in the linked post, it would be something like this:

[% Begin Unverified Perl
my @now = localtime();
return 1900 + $now[5] - GETVALUE('S6');
End Unverified %]
answered Oct 16, 2019 by Zachary Platinum Sawtooth Software, Inc. (144,125 points)
...