How to store 2 value in 1 variable of string?


I have an activity to send email about licenses.

So I have the excel data as base data used in RPA that contains license data (Windows, symantec, kaspersky, etc).

The goal is I have to output the data in list form like this without using for each or for each row in data table using 1 variable only, because I want to send the data through outlook mail. Below is the example of body mail :

Below is the license data :

I tried to use list and array, and I only did get the Kaspersky result (the last one). How to output all the variables? This is my variable :

strJoin = string.Join(",",arrLicense)

Strjoin is in string var type

I tried list and add to collection activity, I tried array of string, append expression and it’s still not working as expected.

Hey @Rhys18,

Have a look on the below thread
Adding multiple values to one key of Dictionary in excel.

In this you can get to know to add multiple values to a single key.


Hi @Rhys18

Have a look on the video link



If your original data is datatable, the following might help you.

String.Join(vbCrLf,dt.AsEnumerable.Select(Function(r) String.Join(",",r.ItemArray)))


@Gokul001 @Sanjit_Pal


Is there any other way other than using dictionary? Because I feel like maybe with string.join or append or concat will do?

Actually it’s not in datatable.

So I create a variable like this :


so when I pass the variable in the mail body, the output should be :

License windows will expired xx more days
License kaspersky will expired in xx more days


In this case, perhaps you should use List<String> and AddToCollection activity as the following.


What is the someCollection var in the for each?



I guess you use ForEach activity but I don’t know its source collection. So, I wrote it as provisional.
If you can share a little more broadly, we might be able to write it more specifically.



This is my workflow :

Main.xaml (28.2 KB)

Hi, the desired output is outcomed as expected.

So I decided to create a new data table, then store the varaible to a new data table and I’m using this expression you give

String.Join(vbCrLf,dt.AsEnumerable.Select(Function(r) String.Join(",",r.ItemArray)))

this is the output :


I had to blur the data because it’s company data. Thank you very much !


For now, can you try to move Assign : list_license = New List(Of String) from inside If activity to just before ForEachRowinDataTable activity?


I just tried this, It’s working as expected too… Thanks for the help !!

1 Like