Filter Particular column

I have excel and in that i have to get only account number column using select().
Please tell me how to achieve this. I used this FilteredDT=dt_Table.Select(“[Accountnumber]”).CopyToDataTable

image

Hi,

Can you try the following expression?

FilteredDT = dt_Table.DefaultView.ToTable(False,{"Accountnumber"})
1 Like

no, its not working

Hi,

Is your requirement to remain “Accoutnumber” column as the following, for example?

image

If so, the above expression works. can you check the following sample?

Sample20221228-5.zip (8.4 KB)

If not, can you elaborate your requirement?

Regards,

Hey its working ya but i dont want the column name i.e header…How to achieve this

image
And also please explain it man

Hi,

FilteredDT=dt_Table.Select(“[Accountnumber]”).CopyToDataTable

According to your first expression, it seems you need DataTable as result, right?

If it’s unnecessary to output header, please turn off AddHeader property of WriteRange activity.

Or if you need string array, the following expression will help you.

dt_Table.AsEnumerable.Select(Function(r) r("Accountnumber").ToString).ToArray()

Regards,

dt_Table.AsEnumerable.Select(Function(r) r(“Accountnumber”).ToString).ToArray()
when i use this what should be the FilteredDT type? datatable variable or string

image

It should be string array type.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.