Data table select multiple columns, no filter condition

I am using the 2017 version of UiPath so there is no Filter Data Table activity.

How do I select entire columns from a data table as a separate data table? Without looping or filter conditions as mentioned in other answers. Couldn’t find any definitive answer for this

Thanks

Check this posts.

Thanks I understand that there are other posts regarding this but these do not fulfil the use I want to achieve that’s why I am asking here. I just want to select entire columns and present it as another data table, without any filtering or sorting or looping as mentioned in these answers

Or, how do I modify the DataTable.Select method to not have any filtering criteria?

@DEATHFISH Download this zip file for your reference

You Can try this
Datatable.defaultview.totable(false, “columnnameA”,“columnnameB”).Copytodatatable

this will give you the column required without filtering

Hello @Vijay_Tulsalkar,

How can i pass WHERE condition in dtExcel.defaultview.totable(false, “TransactionNumber”,“Status”).Select.CopyToDataTable ?

Regards,
Nidhees

Hi @nidheessingh

there are many ways to do it one approach would be the following…

(From x In (dt.defaultview.totable(False, “columnnameA”,“columnnameB”)).asenumerable()
Where YourCondition
Select x).copytodatatable

  1. Approach

dt.defaultview.totable(False, “columnnameA”,“columnnameB”).Select().Where(Function(x) YourCondition).CopyToDataTable

Example:

dt.defaultview.totable(False, “columnnameA”,“columnnameB”).Select().Where(Function(x) Convert.ToString(x(“columnnameA”)).Equals(“xyz123”)).CopyToDataTable

Hello @Vijay_Tulsalkar,

Thanks for your reply…

I am not aware of LINQ and therefore, it is very confusing for me.
I am sharing an excel sheet in which, there is a column “ProviderTransactionNumber” that have duplicate transaction numbers which denote a single transaction of a customer.

Another column is “Status” which denote 2 types of Status “REVERSED” and “REVERSAL SUCCESS”.

Status “REVERSED” means reversal process initiated from the bank for a transaction number. When the amount is credited to Customer A/c successfully then, there is another status is triggered by the bank which is called “REVERSAL SUCCESS” for the same transaction number and therefore, “ProviderTransactionNumber” column has the duplicate transaction number.

Now, my requirement is to fetch a transaction number that has both Statuses - “REVERSED” and “REVERSAL SUCCESS” and generate a single row of transaction. Likewise, all duplicate transaction numbers, I have to generate unique records in the following format (for e.g.)

DT_Out_Result_11 - Copy.xlsx (227.9 KB)

Regards,
Nidhees

Hi @nidheessingh

Check if this met your requirement . Pass the required Excel file Path …

Final.xaml (4.7 KB)

Hello @Vijay_Tulsalkar,

Thank you so much.
Your given solution worked as per requirement.

My last query regarding same excel data…

There are some more transaction numbers under “ProviderTransactionNumber” column which are not duplicate and its Status can be either “REVERSED” or “REVERSAL SUCCESS” only.

Status - “REVERSED” denotes about those transactions whose reversal process has been initiated but the amount has not been credited into Customer A/c and therefore, such transactions have no duplicate transaction numbers under “ProviderTransactionNumber” column and accordingly its “REVERSAL SUCCESS” status entry not available in excel sheet.

Status - “REVERSAL SUCCESS” denotes about those transactions whose reversal process has been completed and the amount has also been credited into Customer A/c and therefore, such transactions have no duplicate transaction numbers under “ProviderTransactionNumber” column because it is a possibility that there may be no “REVERSED” status entry available in the excel sheet.

So, for this type of unique transactions whose status is either REVERSED or “REVERSAL SUCCESS” only and has no duplicate transaction number, I also have to capture these using the previous query as you mentioned in “Final.xaml” workflow.

For your understanding, I am sharing my updated Input data format and accordingly expected output plus updated excel sheet as an attachment.


DT_Out_Result_11 - Copy.xlsx (220.0 KB)