here:dt = New Table( "Single Evaluation in Column Formula Example",
Add Rows( 1000 ),
New Column( "Timestamp",
Numeric,
"Continuous",
Format( "ddMonyyyy h:m:s", 22, 0 ),
Input Format( "ddMonyyyy h:m:s", 0 ),
Formula( Today() - (1000 + In Days( Row() )) )
),
New Column( "Local With As Constant",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
Local( {startofweek},
startofweek = As Constant(
Random Uniform(
Col Min( :Timestamp ),
Col Max( :Timestamp ) - In Days( 7 )
)
);
If(
:Timestamp > startofweek & :Timestamp < startofweek
+In Days( 7 ),
1,
0
);
)
)
),
New Column( "Global With Evaluation in Row 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
If( Row() == 1,
::: startofweek = Random Uniform(
Col Min( :Timestamp ),
Col Max( :Timestamp ) - In Days( 7 )
)
);
If(
:Timestamp > ::: startofweek & :Timestamp < ::: startofweek
+In Days( 7 ),
1,
0
);
)
)
);
here:dt << Graph Builder(
Size( 833, 456 ),
Show Control Panel( 0 ),
Variables(
X( :Timestamp ),
Y( :Local With As Constant ),
Y( :Global With Evaluation in Row 1 )
),
Elements( Position( 1, 1 ), Line( X, Y, Legend( 7 ) ) ),
Elements( Position( 1, 2 ), Line( X, Y, Legend( 6 ) ) )
);
for each( {i}, 1::10,
wait(1);
here:dt << Rerun Formulas;
);