Re: In For loop, Creating new column i, add formula using i in column nameThe current error is,
when call the 1st speed result, "Jame_Speed_5*i" , the i can not be recognized at 1, etc.
Re: In For loop, Creating new column i, add formula using i in column nameThere are 5 different columns naming as:
Jame_Speed_5*1
Jame_Speed_5*2
Jame_Speed_5*3
Jame_Speed_5*4
Jame_Speed_5*5
I hope to commpare each speed and give the results for each corrsponding column.
Re: In For loop, Creating new column i, add formula using i in column nameThe formula component of New Column will not work correctly the way you have it set up. First, the value of "i" needs to be concatenated to the literal string "Jame_Speed_5". Secondly, the fromula component will not parse and evalueate the concatenation, it will just assume that it is part of the formula, thus the Substitution needs to be used to completly build the formula before the New Column statement is parsed. Thirdly, the column name of "Jame_Speed_5*1" will be interpreted by JMP as a calculation, not a column name. Therefore, the :Name() function needs to be used to specify to JMP that it is a name, not a calculation. See below:
For( i = 1, i <= 5, i++,
Eval(
Substitute(
Expr(
dt << New Column( "Jame" || Char( i ),
Character,
"Nominal",
Formula(
If( 100 > __speed__ > 8,
"Pass",
"fail"
)
)
);
),
Expr( __speed__ ), Parse( ":Name(\!"Jame_Speed_5*" || Char( i ) || "\!")" )
)
)
);Re: In For loop, Creating new column i, add formula using i in column nameThanks very much
@txnelson wrote:
The formula component of New Column will not work correctly the way you have it set up. First, the value of "i" needs to be concatenated to the literal string "Jame_Speed_5". Secondly, the fromula component will not parse and evalueate the concatenation, it will just assume that it is part of the formula, thus the Substitution needs to be used to completly build the formula before the New Column statement is parsed. Thirdly, the column name of "Jame_Speed_5*1" will be interpreted by JMP as a calculation, not a column name. Therefore, the :Name() function needs to be used to specify to JMP that it is a name, not a calculation. See below:
For( i = 1, i <= 5, i++,
Eval(
Substitute(
Expr(
dt << New Column( "Jame" || Char( i ),
Character,
"Nominal",
Formula(
If( 100 > __speed__ > 8,
"Pass",
"fail"
)
)
);
),
Expr( __speed__ ), Parse( ":Name(\!"Jame_Speed_5*" || Char( i ) || "\!")" )
)
)
);
In For loop, Creating new column i, add formula using i in column nameAs below, but it doesn't work, any thouhgts will be appreciated.
The goal is to call Jame's speed from 5 different tests, and compare to criteria.
For( i = 1, i <= 5, i++,
dt << New Column( "Jame" || Char( i ),
Character,
"Nominal",
Formula(
If( 100 > Column( "Jame_Speed_5*i" ) > 8,
"Pass",
"fail"
)
)
)
);