Hello,
I have a question of how to merge two tables with different row numbers.
The first table is
The 2nd table is
The final Table I want is
Interactively, you would just run the Join platform
Tables==>Join
and specify to match based upon Time.
Below is a script doing the same thing as the interactive actions would do
Names Default To Here( 1 ); // Create the first table dt1 = New Table( "Table 1", Add Rows( 4 ), New Column( "Time", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [18, 18, 19, 19] ) ), New Column( "Tool", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [2, 2, 3, 3] ) ) ); // Create the second data table dt2 = New Table( "Untitled 10", Add Rows( 2 ), New Column( "Time", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [18, 19] ) ), New Column( "Tool", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [5, 8] ) ) ); // Join the 2 tables dt3 = dt1 << Join( With( dt2 ), Merge Same Name Columns, By Matching Columns( :Time = :Time ), Drop multiples( 0, 0 ), Include Nonmatches( 0, 0 ), Preserve main table order( 1 ) );
Thank you, it works!