How to get datatable with specified Columns only

Hai ,
Anyone can help me how to filter DataTable with specified column Values (using Assign Activity only).
In following attachement I want Data Table only “Invoice Item” AND “DATE”.


Thanks and Regards,
Likith Pallela

Hi @likith_rajesh

Welcome to the community!!
You can use the assign activity and use the below expression to filter your datatable.

YourDataTable.Select("[Date] = '01/28/2017' AND [Invoice Item] = 'Concierge Services'")

This will return a DataRow Array. However below change will convert the output to a datatable again

YourDataTable.Select("[Date] = '01/28/2017' AND [Invoice Item] = 'Concierge Services'").CopyToDataTable

If this works for you, please mark the answer as the solution so it will help others as well :slight_smile:

1 Like

Hai @Lahiru.Fernando
Thanks for your Response. But I want whole rows with Column names “Date” and “Invoice Item”.

How about this activity

https://activities.uipath.com/docs/filter-data-table

Hi @likith_rajesh,

If you want to use assign statement, use the below expression and store in datatable.

Datatable.Defaultview.totable(false,“Invoice Item”,“Date”)

2 Likes

Hai @anil5 ,
Thanks. Its working fine perfect.

1 Like

select column name from table name where condition

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