Welcome to the Community.
The actual statements that will select rows within a given date range and create a new data table with just those selected rows included.
// Select the row that have the date range desired
dt << select where( :Start Date >= informat("01/10/2025","m/d/y") &
:End Date <= informat("04/30/2025","m/d/y"));
// Create the new table
dtSubset = dt << subset( selected columns(0), selected rows(1), output table("theSubset"));
Here is a full example that first creates an example data table, and then runs the above lines to select and create the data table.
(Note: Below example was somehow left out of original posting. Thanks to @jthi for heads up on the omission )
Names Default To Here( 1 );
// Create an Example data table
dt = New Table( "Example",
Add Rows( 20 ),
New Column( "Start Date",
Format( "m/d/Y" ),
set each value( Today() + In Days( Random Integer( 1, 100 ) ) )
),
New Column( "End Date",
Format( "m/d/Y" ),
set each value( :Start Date + In Days( Random Integer( 1, 50 ) ) )
)
);
// Select the row that have the date range desired
dt << select where(
:Start Date >= Informat( "01/10/2025", "m/d/y" ) & :End Date <=
Informat( "04/30/2025", "m/d/y" )
);
// Create the new table
dtSubset = dt << subset(
selected columns( 0 ),
selected rows( 1 ),
output table( "theSubset" )
);
Another interesting, interactive way to create the new table is to use a Data Filter. The Data Filter allows the user to interactively select rows in the data table, and once the desired rows are selected, a new table from those rows can be created.
To to this: Once the data table is displayed
Go to the Rows pull down menu and select "Data Filter"
In the Data Filter window, select the Start and End Dates, and Click on the + sign
The Filters will then be displayed.
Click on the Show and Include check boxes. The indicate the action to take on the rows in the data table when the setting for the filters select the rows.
Now the Filters can be set to make the selection. The blue lines can be dragged to the desired Star and End Dates, or the values can be directly typed in in the displayed date area for each filter.
Please note how the rows in the data table become selected as the filters are changed
Once the desired rows are selected a new data table can be created by selecting the Show Subset selection from the Data Filter red triangle's list of actions. Just click on the red triangle beside the Data Filter title and select the option
Jim