ldiaz
(Leonardo Diaz)
December 22, 2022, 1:32pm
1
hi i want to filter a data table and if the condition of filtering not met. it will proceed to the next sequence. how can i do it. ty in advance
O_Filtered_BSP094 = (From r In BSP094_ADJUSTED_DT.Select() Where r(46).Equals(“O”) Select r).CopyToDataTable
Anil_G
(Anil Gorthi)
December 22, 2022, 1:43pm
2
@ldiaz
Please try like this
BSP094_ADJUSTED_DT.AsEnumerable.Where(function(x) x(46).ToString.Trim.Equals("O")).CopyToDataTable
Hope you are trying to filter 47th column with O
cheers
Hello @ldiaz
You can check the below thread to do the filtering. Then use an if condition to check whether the datatable filtered is having some rows “filteredDatatable.Rows.Count>0”
I’m trying to select all rows from a datatable that have column values present in a list. I would prefer to use a linq query as the list will be dynamic and not ideal for filter data table activity
For example, DT1
Col1, Col2
1, dog
2, cat
3, tree
4, big dog
list_for_col2 = “dog, cat”
The output datatable should be
DT2
Col1, Col2
1, dog
2, cat
4, big dog
Thanks
system
(system)
Closed
December 26, 2022, 8:21pm
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.