Hi,
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
Here 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 )
)
);
so, 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
You 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 ) );
Here 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 )
)
);
so, 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