Hello, how to filter dates later than today in the datatable? Please step by step, I’m learning how to use datatable, so your tips are a valuable lesson for me. Thank You! ![]()
Hi @sullivanne
→ Use the Read range workbook activity to read the excel and store in a datatable called dt_Input.
→ You can use the LINQ Expression in the assign activity as below,
- Assign -> dt_Output = dt_Input.asenumerable.where(Function(X) CDate(X("Column name").toString) > DateTime.Now).Copytodatatable()
→ Then you can use the Write range workbook activity to write the dt_output to excel.
The filtered data will be stored in dt_Output which the dates are later than today.
Hope it helps!!
1 Like
Hi @sullivanne ,
Step 1: Assign Today’s Date
- Add an Assign Activity to store today’s date in a variable.
- Create a variable named
todayDateof typeDateTime. - In the
Tofield, writetodayDate. - In the
Valuefield, writeDateTime.Now.Date.
Step 2: Filter the DataTable
- Add a Filter Data Table Activity to filter rows with dates later than today.
- Drag the
Filter Data Tableactivity to your sequence. - In the
Input DataTablefield, specify the DataTable you read from read range of workbook in Step 1. - In the
Output DataTablefield, create a new variable to store the filtered DataTable, e.g.,filteredDataTable. - In the
Filter Wizard, set the condition to filter the dates:- Select the column with the dates, e.g.,
DateColumn. - Choose the operator
>(greater than). - In the value field, write
todayDate
- Select the column with the dates, e.g.,
Regards
Sandy
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.