Hi,
I found a potentially dangerous "bug" in the Update function. When updating a data table using "By Matching Columns", if the final "s" is omitted, this script will update by row. This is an easy mistake to make, and difficult to catch (since no error is thrown). Can this be addressed in the next JMP update? This problem was found on JMP12.
Thanks!!
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Column( "UniqueID",
Character,
Nominal,
Formula( :name || ", " || Char( :age ) || ", " || :sex || ", " || Char( :height ) || ", " || Char( :weight ) )
);
dt << New Column( "Number", Numeric, Continuous, Format( "Best", 12 ), Formula( Sequence( 1, N Rows(), 1, 1 ) ) );
Column( dt, "UniqueID" ) << Delete Formula;
Column( dt, "Number" ) << Delete Formula;
dt2 = dt << Subset( Columns( "UniqueID", "Number" ) );
dt2 << Sort( Replace Table, By( :Number ), Order( Descending ) );
dt2 << New Column( "Some Column", Character, Nominal, Set Each Value( "x" ) );
dt << Update( With( dt2 ), By Matching Column( :UniqueID == :UniqueID ) );
//dt << Update( With( dt2 ), By Matching Columns( :UniqueID == :UniqueID ) );
dt << Bring Window to Front;