Here are 2 data tables without keys that do a date difference. Is this what you are looking for?
Names Default To Here( 1 );
// Create some sample date data tables
dtProd = New Table( "Production Data",
Add Rows( 15 ),
New Column( "Production Date",
Numeric,
"None",
Format( "ddMonyyyy", 12 ),
Input Format( "ddMonyyyy" ),
Set Values(
[3461875200, 3469737600, 3485462400, 3506630400, 3509049600, 3530217600, 3545942400, 3567110400, 3590697600,
3606422400, 3614284800, 3651177600, 3659040000, 3666902400, 3688070400]
)
)
);
dtMaint = New Table( "Maintenance Data",
Add Rows( 4 ),
New Column( "Maintain Date",
Numeric,
"Continuous",
Format( "ddMonyyyy", 12 ),
Input Format( "ddMonyyyy" ),
Set Values( [3444163200, 3528316800, 3603744000, 3689539200] )
)
);
// Create a new column in the Production Data table
dtProd << New Column( "Days since maintenance", Format( "Fixed Dec", 8,0 ) );
// Populate the new column by finding the most recent value of the Maintain Date
// that is less than the current Production Date, and then find the Difference
// in days
For( i = 1, i <= N Rows( dtProd ), i++,
selectionMatrix = dtMaint << get rows where( dtMaint:Maintain Date <= dtProd:Production Date[i] );
dtProd:Days since maintenance[i] = Date Difference(
Max( dtMaint:Maintain Date[selectionMatrix] ),dtProd:Production Date[i], "Day");
);
Jim