Fresher
(Fresher)
October 3, 2022, 6:55pm
1
I’m having an data table and I need to filter certain rows when the column(0) starts with 155 number.
I tried using filter data table and given the condition as starts with and value as “155” ( string ) and 155 ( int ), Neither of them works.
Before reading the data table from excel, I have changed the column type to number, still its not working
So used preserve type " on" , again its not working.
Noticed in one of the forum topic that starts with is function of string,
Could you please assist me on filtering the numeric value by starts with condition ?
Thanks
Hi @Fresher
Can you try this
dt_Data.AsEnumerable.Where(Function(r) r(0).ToString.Trim.StartsWith("155")).CopyToDataTable
Where dt_Data is your Data Table variable
Fresher
(Fresher)
October 3, 2022, 7:16pm
3
@kumar.varun2 - Thanks you response, yes its working fine…
Is it ok to convert the numeric value to string and validate ( eg: starts with, contains. etc…)
Yes. For these type of comparison it is fine.
For arithmetic comparison the number should be in number format, like <,>,<=,>= etc.
Fresher
(Fresher)
October 3, 2022, 7:21pm
5
@kumar.varun2 - Thank you !!
1 Like
system
(system)
Closed
October 6, 2022, 7:21pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.