Saving Variables to New Tables and New ColumnsI wrote a script that finds rows where col2 and col3 match specific strings and then returns the value of the cell in col7 of those rows. However, I am having problems writing these variables to New Columns in New Tables.
....
New Table( "Results",Add Rows( 2 ),
New Column( " FUS",Character,"Nominal",
Set Values({"Fus1","Fus2"})),
New Column( "PASS/FAIL",continuous,"Nominal", formula( Name Expr(APass)),formula(Name Expr(BPass)));
) Here, APass and Bpass are variables that equal the column7 value from respective search rows. They are strings Pass and Fail respectively. However, when I create the table the last function overides and fills in its results across the entire table. So the table should be Fus1-Pass Fus2-Fail, but outputs Fus1-Fail Fus2-Fail. The reverse when I change the order.
Any help on how to populate a new column with multiple variables ?
Much Appreciated
ScriptingWindowsRe: Saving Variables to New Tables and New ColumnsAs stated in your previous discussion on this topic, You CANNOT have to formulas defined for a column. Here is a simple illustration of that using the Big Class data table. If you define 2 formulas for a column, the second formula will replace the first formula.
new column("two formula", formula(:height), formula(:weight));
Gives the following results

Note that the second formula defined is the one JMP ends up using.
Now, this is not saying that a formula can not be complex. One can actually define a formula that treats each row differently. It just has to be defined in one formula. Here is a simple example of a more complex formula that takes multiple columns into the formula, and makes comparisons between them.
New Column( "combined formula",
formula(
If(
:Sex == "F" & :age > 12, :weight,
:Sex == "F" & :age <= 12, :height,
:Sex == "M" & :age > 13, :weight,
:Sex == "M" & :age <= 13, :height
)
)
)
