Hi.
I’m trying to filter a datatable using the “Select” function.
This is my select:
“dtOut.Select(”[Customer] NOT LIKE ‘0%’ and [WBS Element] NOT LIKE ‘’ and [Net Sales]>‘0’ and [Profit center] LIKE ‘1111’ or [Profit center] LIKE ‘2222’ or [Profit center] LIKE ‘3333’ or [Profit center] LIKE ‘4444’ or [Profit center] LIKE ‘5555’ or [Profit center] LIKE ‘6666’").CopyToDataTable
and the studio gives me no error. But when I open the excel file, where I make a write range with the selector result, the data does not respect my filter.
I’ve already tested the filter step by step, with each filter isolated and all of them Works! But when I make it all together for some reason it stops working.
dtOut.Select(”[Customer] NOT LIKE ‘0%’ and [WBS Element] NOT LIKE ‘’ and [Net Sales]>‘0’ and ([Profit center] LIKE ‘1111’ or [Profit center] LIKE ‘2222’ or [Profit center] LIKE ‘3333’ or [Profit center] LIKE ‘4444’ or [Profit center] LIKE ‘5555’ or [Profit center] LIKE ‘6666’)").CopyToDataTable
Yes and since the query has AND operators, most likely that’s the reason the Select statement is returning 0 rows. Besides the brackets you mentioned in your post.