How to apply multifilter at the same tile in datatable

i have excel data in datatable now i want to filter rows with starting 2ya ,8tb and QML
here the challenge is now i have 3 rows to filter .but i want dynamically to filter rows so that if tommorow if the rows are increased i can filter

Actually iam using for each row and do iam using filter datatable activity but here when i pass the current row it is filtering the 1 row but in the next iteration earlier filter is unfiltered
and new filter is applied
i want all the filters to be applied at same time how can do this

attaching sample data
Filter Rows.xlsx (8.4 KB)

@T_Y_Raju

Can you please show your flow how it looks…are you reading into datatable or directly on excel?

Cheers

image

here iam all values getting stored in DT Black datatable and i want to filter all the stored value in another excel and apply multi filter

@T_Y_Raju

So you mean you want to do multiple filter on excel?

If yea then ideally modern filter excel in loop should be working

Cheers

in modern i can filter only one row at same time

@T_Y_Raju

In loop it would not remove previous filter and can work with new as well

Also if you select advanced more options are present

Cheers

no when loop running firstly it is selecting the filter in excel but in next itration another filter is applied and previoes one is dedelected

@T_Y_Raju

please use this macro…save as text file and use invoke vba…pass the required values as comma separated string…it will filter will all together…Assuming you want to filter column A …if not change it accordingly in range

Sub Macro1(str As String)
    Set ws = ActiveSheet
    If ws.AutoFilterMode Then
        ws.AutoFilterMode = False
    End If
    filtervalues = Split(str, ",")
    ws.Range("A1").AutoFilter Field:=1, Criteria1:=filtervalues, Operator:=xlFilterValues
End Sub

cheers

but my data where values are stored in in DT_Black, how to pass that current row value in macro

@T_Y_Raju

dont pass current row…pass all values together

String.Join(",",dt.AsEnumerable.Select(function(x) x("ColumnName").ToString))

pass this as argument in macro dont use any loops

cheers

filtervalues = Split(str, “,” String.Join(“,”,dt.AsEnumerable.Select(function(x) x(“ColumnName”).ToString)))
like this

can u send me sample flow iam getting confused i have demo tomm

@T_Y_Raju

  1. Save the macro in text file
  2. use invoke vba as below

cheers

i dont have modern activtiy of invoke i have only classic

@T_Y_Raju

Even in classic you would need to do same…only difference is you need to pass the parameters in the parameters property with enclosing in curl braces

Cheers

can u please clarify one thing i have 2 excel workbooks in one workbook iam getting the values and stored in DT_black datable and those values are 2YA, 2XL,8TB now i want to apply a multifilter on the DT_Filtered which is another datatable here in DT_Filtered data i want to apply filter all the values which i got from the DT_Black
how macro will help here …

Use LINQ to get what you want.

@T_Y_Raju

You are conflicting your own statements…I asked you if you want to filter on excel or datatable and you told on dattaable…the above example is to filter on excel using data from a datatable as you explained

If you want to do on datatable then use for loop on first rable…filter datatable and stored it in filtered table and then use merge datatable to add the filtered datatable to a finaldt…this way at the end of loop you will have all filtered data in finaldt

Cheers