Each Row in mail Body

Hello all,

one of my bots reads single rows in a data table, I would like to put its content into the mail body, how can I solve this?

Hello @NHoe

Do you want table in mail body?
Please elaborate on input and output.

I would like to have all values from column A below each other in the mail body.

Hi @NHoe

while iterating through each row in a for loop you can add value of that cell to Add To Collection activity in properties → use below pseudo code to add elements to the list

item = CurrentRow(0).ToString+Environment.NewLine

Once out of the loop you can use String.Join method to get get a string with cell elements in each row, this can be used as mail body

hope this is helpful

1 Like

Hi @AdityaVN thanks for the tip, but I didn’t quite understand it, can you please show me via screeshot?

What @AdityaVN suggested can be done through LINQ also. Use assign activity like this-

mailBodyStr = String.Join(Environment.NewLine, inputDt.AsEnumerable.Select(function (x) x(0).ToString))

This should be used outside the for loop.

Thanks all, it works!

1 Like

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