Append Item To List activity with column index

Hi experts,
I would like to know how I can use append item to list activity if I dont refer to column name but to column index.
Firstly I use Read range workbook activity to group data from excel sheet by specific column. I cant use column name because in excel sheet are two duplicated column names so I refers to column index r(8) (column on eighth position). Then I want to send single separately emails for grouped data in datatable:

So I need Append Item To List activity to collect data to list based on defined columns and then put it to datable. “Item to append” field I use usually CurrentRow(“Personnel Number”).ToString and other colums which I would like to append to list. But it will not work because I didnt refer to columns names in first part but to column index, so how I can define “Item to append” field with column index? I try to change field to CurrentRow r(0).ToString but it cause error.

Thank you for any advice.
Simon.

Hi,

How about CurrentRow(0).ToString ?
If you still have an error, can you share the error message?

Regards,

@Simon1

Ideally it would not throw error…you can use either of them…can you please show the error you are getting

Cheers

Thank you so much CurrentRow(0).ToString works as expected.
Regarding group by and send email, if I group by like on shared WF screenshots above:
dictGroup=dtGroup.AsEnumerable.GroupBy(Function(r) r(6).ToString).ToDictionary(Function(g) g.Key,Function(g) g.CopyToDataTable)

so it is example of my results that data was grouped: by column 6 (it is email reciever)
Column 4------Column 5 (cc email)-------------Column 6 (email reciepent)
A-----------AnotherReciever5@emai.com--------Reciever1@email.com
B-----------AnotherReciever6@emai.com--------Reciever1@email.com
C-----------AnotherReciever7@emai.com--------Reciever2@email.com

so after group by column6 I need to send this data in single email to reciever in column6: e.g. data rows A+B to reciever1@email.com with cc to AnotherReciever5@email.com and AnotherReciever6@email.com
So in send email activity in field “TO” will be currentitem.Key- it works good and send email to Reciever1@email.com with data A+B but I need to include “CC” (AnotherReciever5@email.com and AnotherReciever6@email.com) and it is quit difficult what I should defined…

maybe I need assign new value and then put to “CC” send email activity?
CC_Email = dtEmail.AsEnumerable.ToDictionary(Function(r) r(6).ToString,Function(r) r(5).ToString)

  • in this case column 6 will be vlookuped to column 5 in dictionary and in field “CC” will be CC_Email(currentitem.key). But it cause error Assign: An item with the same key has already been added. becuase in column6 and column5 could be duplicated emails.

One thing regarding datatable- if I append item to list, it will collect data in string and then creates datatble that is then send in email body, I used activity to convert datatable to HTML text- it changes format of date from 31.12.2025 to 01/31/2025 00:00:00 , so probably change date format from excel sheet to text- is it possible to not change format of date? If is possible to defined format CurrentRow(4).ToString to dd.mm.yyyy?

  • Thank you for advice.
  • Simon

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