How to create two new datatables only with rows that have content?

Hello friends, Please, I wanted to ask you the following :

I want to generate two datatables from an excel sheet, as long as it has content.

In the attached example, columns “C” and “D” are the ones filled in by the user. If those two fields contain data, it is classified according to column “E”, then in the end I will have two datatables that I can go through to read their data and enter them into the corresponding web page. There is a web page for “LIMA” and another for “PROVINCE”.

I was thinking of two ways to evaluate the excel:

The first: An array of arrays, where each row of the excel contains
The second: A dictionary, (In this case it would be a dictionary for each column), but to evaluate if the data exists, I am not very clear

Do you know what could be more convenient for the problem?
Test.xlsx (14.3 KB)

1 Like

How you are segregating single into two different sheets ?? can you elaborate your process

I corrected the title of the post, I changed it to interrogative mode. I am trying with dictionaries
Diccionario.zip (75.9 KB)

Can you share a snap of your input and expected output

This is my input, and as output I want two data tables, one with the rows (4, 6, 9) and the second with the rows (13,16,20). My secuence on uipath is still incomplete, I’m not sure how to proceed. For a row to be added to a datatable, columns “C” and “D” must be filled, and these are filled by the user. And to define to which datable it will be added, column “E” is used

Ok wait iam working on it

Hi @Lynx,

Use Filter Data Table,

Select Remove and Under Operation select Is Empty and if you need to check multiple columns, just click + icon and set the condition to AND.

image

Regards,
@90s_Developer

1 Like

can be done with grouping data

Assign Activity
LHS: TableList | List(Of DataTable)
RHS:

(From d In YourDataTableVar.AsEnumerable
Where {"REPORT","TYPE OF CLIENT"}.All(Function (x) Not (isNothing(d(x)) OrElse String.IsNullorEmpty(d(x).toString.Trim)))
Group d By k=d("Area").toString.Trim Into grp=Group
Select t =grp.CopyToDataTable).toList

Then iterate over the returned TableList and process the different datatables

Also have a look here:

Describing also non-LINQ Approaches which you can combine with filter approaches

2 Likes

hi @Lynx

Please find the attached overall project
Diccionario (2).zip (25.9 KB)

1 Like

Thank you very much @Robinnavinraj_S , your solution was quite fast, I thank everyone for their ideas.

1 Like

Your welcome

1 Like

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