Update() replaces data in one table with data from a second table.
dt << Update( // message to first table
With( dataTable ), // the other data table
By Row Number, // default join type; alternative is
// By Matching Columns(col1==col2)
Ignore Missing, // optional, does not replace values with missing values
);
To try this, make a subset of Big Class.jmp, as follows:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
NewHt = dt << Subset( Columns( :name, :height), Output Table Name( "hts" ) );
diff = Random Uniform( 0, 6 );
For Each Row( NewHt, :height = :height + diff );
Finally, update the heights of students in Big Class.jmp with the new heights from the subset table:
dt << Update(
With( NewHt ),
By Matching Columns( :name == :name),
);
Your updated table might contain more columns than your original table. You can select which columns are included in your updated table using the option Add Column from Update Table().
Data Table( "table" ) << Update(
With( Data Table( "update data" ) ),
Match Columns( :ID = :ID ),
Add Columns from Update Table( None )
);
Data Table( "table" ) << Update(
With( Data Table( "update data" ) ),
Match Columns( :ID = :ID ),
Add Columns from Update table( :col1, :col2, :col3 )
);