Hi,
If I understand your question, this would be well beyond agonizing to perform interactively. I take it that you want a subset of the original table, where a row is part of the subset as long as it falls between the begin and end time of ANY row in the begin/end table.
If that is what you would like, the script below will do it. It relies on the evalinsert( ) function to build a string in a legitimate date/time format that JMP can convert to a number natively using the informat( ) command... so be sure to check out these 2 functions in the scripting index.
By default, select where ( ) pre-clears any current row selection. The optional argument current selection ("extend") allows us to select additional rows without losing the prior selection--this allows us to use a loop to make selections incrementally.
Cheers,
Brady
Names Default To Here(1);
////////////////////Build example tables
dt = astable(J(1000,1,randomuniform(today()-3600*24*60, today() + 3600*24*60)), << column names({"Timestamp"}));
dt:Timestamp << Input Format( "ddMonyyyy h:m:s", 0 ) << Format( "ddMonyyyy h:m:s", 22, 0 );
dt << Sort( By( :Timestamp ), Replace Table, Order( Ascending ) );
yearMat = J(20,1,2021);
monList = words("May,Jun,Jul,Aug,Sep",",")[J(20,1,randominteger(1,5))];
dayMat = J(20,1,randominteger(1,30));
amMat = J(20,1,7*3600 + randominteger(0,20)*60);
pmMat = J(20,1,16*3600 + randominteger(0,20)*60);
dt2 = new table("lookups",
<<new column("Year", <<set values(yearMat)),
<<new column("Month", character, <<set values(monList)),
<<new column("Day", <<set values(dayMat)),
<<new column("Start", <<set values(amMat), Input Format( "h:m" ), Format( "h:m", 10 )),
<<new column("End", <<set values(pmMat), Input Format( "h:m" ), Format( "h:m", 10 ))
);
//////////////////////////////end table building
//begin processing. the idea is to cycle through all rows of the lookup table,
//selecting matching rows in the original table
dt << clear select;
for(r = 1, r<= nrow(dt2), r++,
//piece together beginning and ending date/time strings using evalinsert(),
//and use informat() to convert to a numeric value
begin_time = informat(evalinsert("^dt2:day[r]^^dt2:month[r]^^dt2:year[r]^ ^format(dt2:Start[r], \!"h:m\!")^"));
end_time = informat(evalinsert("^dt2:day[r]^^dt2:month[r]^^dt2:year[r]^ ^format(dt2:End[r], \!"h:m\!")^"));
//select cells in the main table with a timestamp in this range.
//the current selection ("extend") option augments the current selection, instead of replacing it (the default behavior)
dt << select where (begin_time <= :timeStamp < end_time, current selection("extend"));
);
dtSub = dt << subset(selected rows(1), selected columns(0));
dt << clear select;