Re: how do l use the value from another variable as the first value then add 3.3 for each thereafterYou need to take the time to read the documentation on JSL.
Help==>Books==>Scripting Guide
The way to do this is a very simple formula
ACC << New Column( "exp", formula( :Obs +3.3 ) );
Re: how do l use the value from another variable as the first value then add 3.3 for each thereafterSorry, l may have confused you, the first value of "exp" equals "obs", then i would like to add 3.3 to the prior value of "exp", so in this case, the first value of "exp" is equal to 12.3, then add 3.3 to this value for the second value of "exp" = 15.6, the third = 18.9, so the first value of "exp" is dependent on "obs" but none of the other values are, your "very simple formula" will not achive this.Re: how do l use the value from another variable as the first value then add 3.3 for each thereafterHere are a couple of ways to do what you outlined in your last response
New Table( "Example",
Add Rows( 8 ),
New Column( "Obs",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [12.3, 15.4, 18.7, 22, 25.8, 28.9, 32.2, 35.1] )
),
New Column( "exp1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
If( Row() == 1,
start = :Obs,
start = start + 3.3
);
start;
)
),
New Column( "exp2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( :Obs[1] + (Row() - 1) * 3.3 )
)
);Re: how do l use the value from another variable as the first value then add 3.3 for each thereafterso, this simple formula might work.
Sounds like you want the result to be lag one cell plus a constant.
like this?
Lag(:Expected) + 3.3
Re: how do l use the value from another variable as the first value then add 3.3 for each thereafterThanks so much, worked a treatRe: how do l use the value from another variable as the first value then add 3.3 for each thereafterThanks very muchhow do l use the value from another variable as the first value then add 3.3 for each thereafterHi,
Was wondering if anyone can help me with a syntax problem, l wish to use the first value from another variable then increase this value by 3.3, the same as the below,
Obs Expected 12.3 12.3 15.4 15.6 18.7 18.9 22.0 22.2 25.8 25.5 28.9 28.8 32.2 32.1 35.1 35.4
Currently I have set the values as follows, however I would really like to automate as l have a few to do
Acc << New Column( "exp", Numeric, Continuous, Format( "fixed dec", 6, 1 ), Set Selected, Set Values( [12.3, 15.6, 18.9, 22.2, 25.5, 28.8, 32.1, 35.4] ) );Thanks to all