Here are some visuals to support @jthi and @hogi suggestions
Issue 1
Tables=>Join Joining Table 2 to Table 1
Issue 2
Tables=>Sort Create a Virtual Column and call it Row.......the formula for the column is Row()
Then
Tables=>Join Join Table 1 to Table 2
Here is the JSL that will run the 2 issues
names default to here(1);
dt1 = New Table( "Table 1",
Add Rows( 6 ),
New Column( "Parameter Set Name",
Character,
Set Values(
{"27109N5", "27109N5", "27109N5", "27109N5", "27109N5", "27109N5"}
)
),
New Column( "Timestamp",
Format( "yyyy-mm-dd", 12 ),
Input Format( "yyyy-mm-dd" ),
Set Values(
[3600115200, 3600115200, 3600201600, 3600201600, 3600201600, 3600201600]
)
),
New Column( "Parameter X",
Set Values( [2.32, 1.21, 1.45, 1.45, 7.89, 2.04] )
)
);
dt2 = New Table( "Table 2",
Add Rows( 2 ),
New Column( "Parameter Set Name",
Character,
Set Values( {"27109N5", "27109N5"} )
),
New Column( "Timestamp",
Format( "yyyy-mm-dd", 12 ),
Input Format( "yyyy-mm-dd" ),
Set Values( [3600115200, 3600201600] )
),
New Column( "Parameter Y",
Format( "Best", 12 ),
Set Values( [21, 22] )
)
);
// Join data tables
// → Data Table( "One to Many" )
Data Table( "Table 1" ) << Join(
With( Data Table( "Table 2" ) ),
Merge Same Name Columns,
By Matching Columns(
:Parameter Set Name = :Parameter Set Name, :Timestamp = :Timestamp
),
Drop multiples( 0, 0 ),
Include Nonmatches( 0, 0 ),
Preserve main table order( 1 ),
Output Table( "One to Many" )
);
// Create the Many to One table
// Sort data table
Data Table( "Table 1" ) << Sort(
By(
:Parameter Set Name,
:Timestamp,
Transform Column( "Row", Formula( Row() ) )
),
Replace Table,
Order( Ascending, Ascending, Descending )
);
// Join Table 1 to Table 2
// Join data tables
// → Data Table( "Many to One" )
Data Table( "Table 2" ) << Join(
With( Data Table( "Table 1" ) ),
Merge Same Name Columns,
By Matching Columns(
:Parameter Set Name = :Parameter Set Name, :Timestamp = :Timestamp
),
Drop multiples( 1, 1 ),
Include Nonmatches( 0, 0 ),
Preserve main table order( 1 ),
Output Table( "Many to One" )
);
Jim