How to filter data from DT with 2 AND conditions

Hello all,

could you please help with defining the condition?
I am filtering data from data table with a condition must be pGroup = 72C AND requestioner = CXUHR AND plant = ORCP AND Material is not emplty. Important part: first 3 conditions are valid only if all of them are fullfiled.
I use this in IF activity: (pGroup =“72C” AND requestioner =“CXUHR” AND plant = “OCRP”) AND Material <>""
But the result is 0 rows filtered, although I expected 4 filtered. Where I do a mistake please?

DATA HERE, first 3 rows should be in a result:
|pGroup| requestioner| plant| Material| Expected result|
|72C| CXUHR| ORCP| 72486265| Should include|
|72C| CXUHR| ORCP| 16705128 | Should include|
|72C| CXUHR| ORCP| 80973676| Should include|
|72C| CXUHR| ORCP| | Should exclude|
|72C| CXUHR| ORCP| | Should exclude|
|72C| CXUHR| ORCP| | Should exclude|
|72C| CXUHR| ORCP| | Should exclude|

Thank you for your advise

Regards,

Marian

@Mariansson

filtering the datatable should be possible to do it with the filter datatable activity:
grafik

in case of some uncleaned data is to handle (e.g. Excel: space in columns…) we can use LINQ

(From d in datatableVar.AsEnumerable
let arrCVal = {"72C","CXUHR","ORCP"}
Where {0,1,2}.All(Function (x) d(x).toString.Equals(arrCVal(x))) And Not String.IsNullOrEmpty(d(3).toString.Trim)
Select d).CopyToDataTable

Handling empty filter result can be done with this pattern:

1 Like

Thank you ppr. I did not know about filter datatable activity.

I also used additional operator “AndAlso”, which is also good for such as cases.

Regards,

Marian

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