Lo siento por mi igorance Jim, pero su dicho es que debo incorporarlo todo al crear la variable, por lo que debería ser:
Acc << New Column( "lo50%expGMT", Numeric, Continuous, Formula(round(:expGMT / 2 ))); this is the original creation of the variable code.
Cambiar a :
Acc << New Column( "lo50%expGMT", Numeric, Continuous, Formula(If(round(:expGMT / 2 ) >= 10, (5))));
Cuando ejecuto esto, ahora obtengo la variable lo50% expGMT para todas las "5", así que reemplaza todos los valores y una gran parada completa para el último valor, en lugar de 823,412,206,103,52,26,13 y 5
OK ... realmente tenías la respuesta ........ que había malinterpretado. La fórmula es lo que está causando el problema. No puede cambiar el valor en una celda dentro de una fórmula. La fórmula siempre triunfará sobre el cambio. Entonces, lo que debe hacer es eliminar la fórmula como se muestra a continuación, o incorporar el cambio en la fórmula ...
Aquí está el método para eliminar la fórmula.
Names Default To Here( 1 );
Acc = New Table( "Example",
Add Rows( 8 ),
New Column( "base 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 2, 4, 8, 16, 32, 64, 128] )
),
New Column( "base 2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [12, 12, 12, 12, 12, 12, 12, 12] )
),
New Column( "base 3",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[10.684, 9.454, 8.4053, 7.4053, 6.4053, 5.3707, 4.3707, 2.4886]
)
),
New Column( "base 4",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1645, 701, 339, 170, 85, 41, 21, 6] )
),
New Column( "base 5",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1645, 823, 411, 206, 103, 51, 26, 13] )
),
New Column( "base 6",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [823, 412, 206, 103, 52, 26, 13, 7] ),
Set Display Width( 53 )
),
New Column( "base 7",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [3290, 1646, 822, 412, 206, 102, 52, 26] )
),
New Column( "base 8",
Character,
"Nominal",
Set Values(
{"Pass", "Pass", "Pass", "Pass", "Pass", "Pass", "Pass", "Fail"}
)
),
New Column( "lo50%expGMT",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( Ceiling( :base 5 / 2 ) ),
Set Selected,
Set Display Width( 104 )
)
);
Acc << run formulas;
// Delete the formula and set values to real numbers
Acc:Name("lo50%expGMT" )<<DELETE formula=""></DELETE>
Y aquí está la tabla de datos con la fórmula cambiada para incorporar el cambio requerido.
Names Default To Here( 1 );
Acc = New Table( "Example",
Add Rows( 8 ),
New Column( "base 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 2, 4, 8, 16, 32, 64, 128] )
),
New Column( "base 2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [12, 12, 12, 12, 12, 12, 12, 12] )
),
New Column( "base 3",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[10.684, 9.454, 8.4053, 7.4053, 6.4053, 5.3707, 4.3707, 2.4886]
)
),
New Column( "base 4",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1645, 701, 339, 170, 85, 41, 21, 6] )
),
New Column( "base 5",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1645, 823, 411, 206, 103, 51, 26, 13] )
),
New Column( "base 6",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [823, 412, 206, 103, 52, 26, 13, 7] ),
Set Display Width( 53 )
),
New Column( "base 7",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [3290, 1646, 822, 412, 206, 102, 52, 26] )
),
New Column( "base 8",
Character,
"Nominal",
Set Values(
{"Pass", "Pass", "Pass", "Pass", "Pass", "Pass", "Pass", "Fail"}
)
),
New Column( "lo50%expGMT",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( If(Ceiling( :base 5 / 2 ) >= 10, Ceiling( :base 5 / 2 ), 5 ) ),
Set Selected,
Set Display Width( 104 )
)
);