Hi All,
Below is SampleDT
I want to filter all the data where value in Code1 != value in code 2 as OutputDT
I tried using filter DT activity and LinQ but unable to filter and getting all the rows in output.
I am using Uipath Studio 2018.4.3
Please help.
@Anamika15
give a try on
(From d in YourDataTableVar.AsEnumerable
Where Not d("Code1").toString.Trim.Equals(d("Code2").toString.Trim)
Select d).CopyToDataTable
In case of empty filter results are to expect apply following pattern
I have already tried this linq. Its not doing any filter opernation on the datatable.
@Anamika15
can you please do following
set a breakpoint within the flow after data was read in
debug to the Breakpoint
share the datatable content with us (locals panels, expand with click on pencil/magnifier) make screenshot from it
Thanks
Hi @Anamika15
Please look at this method and let me know the result
Step 1 : Assign ResDT->(From ax in InputDT.AsEnumerable select ax.Item(“Code2”)).ToArray
Step 2 : Assign FinalDT->(From roww in InputDT where Not ResDT.Contains(roww.Item(“Code1”)) Select roww).CopyToDatatable()
Here ResDT is of type Object Array (Object) and FinalDT is of type DataTabe
Regards,
@poorna_nayak07
Hi @Anamika15 Try this way
-
Read the excel file and store in dt1 variable
-
use the following linq query to get the required result
Dt3 = dt1.AsEnumerable().Where(Function(row) row(“Code1”).ToString<>row(“Code2”).ToString).CopyToDataTable
-
Write the resultant Dt3 to an excel file
I tried the code with two sample excel sheets as like below
Result i got is (via output datatable activity i output the datatable in string format to demonstrate the result)
Workflow
excel.zip (39.0 KB)
Hope it helps you
Regards
Nived N
Happy Automation
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.