Hi everyone,
DT1: name, id, etc
Jack, 11
Tom, 12
Jerry, 13
Jack, 28
Jerry, 27
…
Result:
DT2: name, id, etc
Jack, 11
Jack, 28
DT3: name, id, etc
Jerry, 13
Jerry, 27
DT4: name, id, etc
Tom, 12
…
thanks for any suggestions!
Hi everyone,
DT1: name, id, etc
Jack, 11
Tom, 12
Jerry, 13
Jack, 28
Jerry, 27
…
Result:
DT2: name, id, etc
Jack, 11
Jack, 28
DT3: name, id, etc
Jerry, 13
Jerry, 27
DT4: name, id, etc
Tom, 12
…
thanks for any suggestions!
Hi @Jolin,
You can use this activity . It will return the result as datatable.
I have use the read range activity. so you must have to install the UiPath.Excel.Activity.
Regards
Balamurugan
Hi @balupad14,
Thanks for your reply. I tried to use the activities you suggested, but I still can not insert Group by data into a new table. DT1 data can be added or deleted dynamically. Could you give me more suggestions?
Hi @Jolin,
Is it possible to attach the source ?
Regards
Balamurugan
Hi @balupad14,
the source files:
test_name.xlsx (8.1 KB)
newTable.xaml (7.4 KB)
Hi @Jolin,
Thank you for using the “BalaReva.DataTable.Activities”. I have modified your source that I have attached it here.
File : GroupInsert.zip (12.9 KB)
I need to share some points with you.
This week or next week , It has a new release with some new features.
Thank you
Balamurugan.S
Hi @balupad14,
Thanks for your reply, but that’s not what I want . I just want to Group by(name),not SUM(money), then insert the same name to a new table. Finally ,the new table can be written into a excel.
Can you understand what I mean?
Appreciated for your any suggestions.
Hi @Jolin,
As I understand that you are going to remove the duplicates . In that case you can use the DefaultView from Datatable like below.
dtNew=dt.DefaultView.ToTable(True,“Column1”,“Column2”,“Column3”,“Column4”) [Specific columns]
or
dtNew=dt.DefaultView.ToTable(True) [All the columns]
Regards
Balamurugan
Hi @balupad14,
Thanks very much for your reply.
Sorry that I didn’t describe the problem clearly, I have attached the output file for a better understanding.outData_file.xlsx (10.4 KB)
Looking forward to your reply
Hi @Jolin
About your question, I commend an easy way.
DV1 = DT1.DefaultView
DT1_name = DV1.toTable(True, “name”)
For Each name In DT1_name
DT(2,3,4…) = DT1.select(“name='”+name+“'”, “id”)
Next
Maybe will help you.
Hi @Jolin,
I saw the xl file. I didn’t understand your expectation result. if you do the group by name, nothing happens in the data. Because you are not going to use the aggregation. Please specify your expected result.
Regards
Balamurugan
Hi @wusiyangjia,
Thanks very much for your suggestion, it’s such an easy way. Under your help, I have already finished it .