Désolé pour mon ignorance Jim, mais vous dites que je devrais tout incorporer lors de la création de la variable, donc ça devrait être:
Acc << New Column( "lo50%expGMT", Numeric, Continuous, Formula(round(:expGMT / 2 ))); this is the original creation of the variable code.
Changer pour :
Acc << New Column( "lo50%expGMT", Numeric, Continuous, Formula(If(round(:expGMT / 2 ) >= 10, (5))));
Quand j'exécute ceci, j'obtiens maintenant la variable lo50%expGMT sera tous "5" donc il remplace toutes les valeurs et un gros point pour la dernière valeur, au lieu de 823,412,206,103,52,26,13 et 5
OK....vous aviez effectivement la réponse.......que j'avais mal interprétée.C'est la formule qui cause le problème.Vous ne pouvez pas modifier la valeur d'une cellule dans une formule.La formule l'emportera toujours sur le changement.Donc, ce que vous devez faire est de supprimer la formule comme ci-dessous, ou d'incorporer le changement dans la formule ......
Voici la méthode pour supprimer la formule
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>
Et voici le tableau de données avec la formule modifiée pour incorporer le changement requis.
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 )
)
);