cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
thoufik11
Level I

Filter data within date and time range

Hi. 

 

I would like to filter data within 2 dates. 

the dates are in another table.

 Table 1:

thoufik11_0-1633663944125.png

 

Table 2:

thoufik11_1-1633664014188.png

How can I filter the data in table 1 that has END_TIME between the START_TIME and END_TIME in table 2?

I want the result in the new table. 

 

Hope I explained it clearly. 

 

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Filter data within date and time range

Here is a simple example of one type of filtering

Names Default To Here( 1 );

// Substitute the actual names of your data table
dt1 = Data Table( "table 1" );
dt2 = Data Table( "table 2" );

// This statement will select all of the rows in data table 1 that are
// between the start and end dates from the second data table
// Taking the value in the second data table's first row for the columns
// START_TIME of SideAStart and END_TIME of SideAEnd
// Not knowing what you really mean as "Filter the Data Table", this is
// a guess as to how you want to "Filter" the data
dt1 << dt1 << select where( dt2:START_TIME of SideAStart[1] <= dt1:END_TIME <= dt2:END_TIME of SideAEnd[1] );
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Filter data within date and time range

Here is a simple example of one type of filtering

Names Default To Here( 1 );

// Substitute the actual names of your data table
dt1 = Data Table( "table 1" );
dt2 = Data Table( "table 2" );

// This statement will select all of the rows in data table 1 that are
// between the start and end dates from the second data table
// Taking the value in the second data table's first row for the columns
// START_TIME of SideAStart and END_TIME of SideAEnd
// Not knowing what you really mean as "Filter the Data Table", this is
// a guess as to how you want to "Filter" the data
dt1 << dt1 << select where( dt2:START_TIME of SideAStart[1] <= dt1:END_TIME <= dt2:END_TIME of SideAEnd[1] );
Jim