Query datatable by remove out the row which contain first letter is "A"

I need to remove the row that word contain first letter is “A”. In example row number 5, 6, 20, 21 and 23 must be remove from datatable

Please advise.
Appreciated for your kindliness sir.

image

Hi @ChatchaiSh,
Can you use Datatable.Select(“[Package Cd] LIKE ‘A%’”) .So you will get new datatable with only contains A. After that you can use for each row activity to remove one by one…

Thanks and regards,
P.Ajithkumar

Hi @ChatchaiSh,

       I Have attached the flow for your Reference .

Test1.xlsx (7.1 KB)
test.xlsx (7.8 KB)
Main.xaml (11.0 KB)

Thanks and Regards,
P.Ajithkumar

Hi @ChatchaiSh,
I can suggest you like , Instead of deleting, just try to filter the datatable as you need.

you can try this,
dtTest.Select("[Column Name] not like ‘A%’ ").CopyTodatatable
The above code wil give you all the records where [Column Name] not starting with alphabet A.

Hope this can help you!

Regards,
SP

Maybe

DT.Select(“[Column Name] NOT LIKE ‘A%’”).ToArray.Copytodatatable

will be more simple for this case.
So you do not need to use [for each] activity.

regrads

Thank you very much. But I try changed the column name to be “Package Cd” to apply with my table. The program will error below.

"Cannot perform ‘Like’ operation on System.Double and System.String.

CopyTodatatable command not identify to use. What I do missing?

Hi @ChatchaiSh
Make Sure That package Cd Format is Text.

Thanks and Regards
P.Ajithkumar

Here are the code that apply from your suggestion sir.

Main.xaml (11.2 KB)
test.xlsx (8.6 KB)
Test1.xlsx (7.9 KB)

Sure…

Thanks and Regards
P.Ajithkumar

Error shown : Cannot file column ['A]
Main2.xaml (9.1 KB)
test.xlsx (8.6 KB)
Test1.xlsx (7.9 KB)

It show error "Cannot find column name ['A].
test.xlsx (8.6 KB)
Test1.xlsx (7.9 KB)
Main2.xaml (9.2 KB)

It still show the error below.

image

You can type it manually. You can only find ‘CopyTo’ then type datatable. ASAT

Regards,
SP

Hi @ChatchaiSh
I have attached the flow for your reference
Main.xaml (12.0 KB)
Thanks and regards,
P.Ajithkumar

You can Convert The format of the column general into Text.

Thanks and Regards
P.Ajithkumar

Try this

DT.Select("Convert([Package Cd],'System.String') NOT LIKE 'A%'").CopyToDataTable

1 Like

@ddrdushy1 It’s worked !!! Thank you so much.

@Ajithkumar_P @SantoshPothina @lainh

And great thanks everyone for your time spent sir.

This is because you typed

‘A%’

.
The formula should be

'A%'

The apostrophe: ' should be half width .

HI @ChatchaiSh,
It has custom activity instead doing more code , can do it in a single activity to delete the rows by conditions.

Sample File :
DeleteRowSelect.zip (1.5 KB)

Regards
Balamurugan

2 Likes