How to evaluate each rows?Hi all,
I have Amplitude 21 as an example data table, and for example, I want to determine if the amplitude passes or fail. How can I evaluate each rows if they are pass/fail?
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Amplitude 21.jmp");
New Column ("Pass/Fail", Character)
Data TableOtherRe: How to evaluate each rows?You can use For Each Row() !
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
For Each Row( :height = -:height );
Re: How to evaluate each column?I don't understand how Amplitude can be > 4 and < 4 unless you are looking for Amplitude values that has the exact value of 4.Below are 3 different ways to do value checking. I hope they make sense to you. BTW, formulas automatically loop through all rows in a data table and run the JSL on each row.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Amplitude 21.jmp" );
New Column( "Pass/Fail",
Character,
formula( If( 4 < :amplitude < 6, "Pass", "Fail" ) )
);
//or
New Column( "Pass/Fail 2",
Character,
formula(
If( :amplitude < 4 | :amplitude > 6,
"Fail",
"Pass"
)
)
);
//or if you are looking for values that are exactly 4
New Column( "Pass/Fail 3",
Character,
formula(
If( :amplitude == 4 ,
"Fail",
"Pass"
)
)
);
Re: How to evaluate each column?Hi txnelson,
Thank you for explaining it clearly. Just an additional question,
How can I apply these in multiple columns? with different set of limits
Re: How to evaluate each column?To make sure that we are fully understanding each other, in regards to columns and rows. In the Amplitude 21 data table, there are 4 columns(Labels, Amplitude, x, y) and 21 rows. Therefore your question
"How can I apply these in multiple columns? with different set of limits"?
You would just create an additional column. If you wanted to apply limits to both Column Amplitude and Column X it would look like this
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Amplitude 21.jmp" );
New Column( "Pass/Fail",
Character,
formula( If( 4 < :amplitude < 6, "Pass", "Fail" ) )
);
New Column( "Pass/Fail X",
Character,
formula( If( 0.5 < :x < 2, "Pass", "Fail" ) )
);