How to Filter Excel Column with column name having a date

Hi,

Attaching a image for reference

I want to filter the column N i.e “Ecenter_12-05-19” with 12 or blanks. I want the same logic as how the filter opn works in Excel, but I don’t want to use the GUI.
I tried **dt= resultTable.Select(“Ecenter_12-05-19 = ‘12’”) but no success.I tried putting the “Ecenter_12-05-19” header in a variable “Ecenter_” +System.DateTime.Today.AddDays(-2).ToString(“dd-MM-yy”) still no result.

PS : The date changes dynamically to the previous date i.e -1…but for now lets hard code it with 12-05-19

Please help…

Thanks in advance :slight_smile:

1 Like

Buddy @Neha2111

You can use filter datatable activity here buddy with datatable obtained from read range activity inside the Excel application scope activity, and by passing input to filter datatable like
Datatable name, column name and conditional operatoraand the value want to check with

Or buddy @Neha2111 you can use select method like this buddy
Outdatarow = In_dt.Select("[Ecenter_12-05-19] = ‘12’ "] which will fetch datarow array of row with 12 value alone in that column cell
where In_dt is your input datatable obtained from read range activity and outdatarow is variable of type array of datarow which can be entered to another datatable by using for each loop with this array as input and type argument in for each loop property as datarow, you can enter this datarow to the datatable using add data row with input as item from for each loop to datarow property in add data row

Simple buddy
Try this and let know whether this works or not buddy
Cheers

Did that work buddy @Neha2111

1 Like

Yes it did. Thanks a ton :slight_smile:

1 Like

Fantastic

Cheers buddy @Neha2111
Keep going

1 Like

Hey,
The column name is not fixed…it changes to today -1 everyday. In that case what can I do? I’ve taken that in a variable how can I pass it in the filter wizard?

Before assigning it to the filter with column name use a variable to get the changing columnname of that column like this
out_column_name = out_dt.Columns(0).ColumnName
and pass this to the filter wizard buddy

where 0 is the columnindex of that column buddy @Neha2111
Cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.