Ticket #424 ( Closed )

Short Description Problem setting value of constant with Function
Entered By: Michael - Charleston When: 1999-12-21 16:01:20 Build: 2.0.6D GA
Categories Type: Problem   Department: Product   Category: SurferScript
Description
The following SurferScript statement in a template in which I store all my global variables (Vars.stml):
<TEDECLARE VAR Name="constant.NowYear" TYPE="INT" data=TextLeft(Now(,4),4)>
results in "0" and not "1999" as one might expect.

The only way I can get this to work is if I change the variable to a server variable and TESET it to the same expression in Global.stml (since apparently TESET requires an active template according to the compiler ...?) I get the desired result "1999".

Append By: WindSurfer  When: 1999-12-21 17:08:56  New Status: Pending Customer
Comment Sorry, data initialization is not done with an expression, only a text constant. We will check into what it will take to convert this to an expression.

You can set a server. variable in the global.startup section (supported in 2.0), using a TESET as you've described, but with the benefit of only having the set work once.

The global.start section is executed immediately following any compile, including the automatic one at Screensurfer start.

By design, the global.startup is also the only section that can write to a constant variable, but this is a planned enhancement and has not been implemented yet.

So for now, switch to a server. variable and use global.startup to initialize it.