Rhys18
(Rizky Albert Hartono)
September 5, 2022, 4:23am
1
Hi,
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 :
Windows
Symantec
Kaspersky
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.
Sanjit_Pal
(Sanjit Pal)
September 5, 2022, 4:28am
2
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.
Thanks,
Sanjit
Gokul001
(Gokul Balaji)
September 5, 2022, 4:34am
3
Hi @Rhys18
Have a look on the video link
Regards
Gokul
Yoichi
(Yoichi)
September 5, 2022, 4:35am
4
Hi,
If your original data is datatable, the following might help you.
String.Join(vbCrLf,dt.AsEnumerable.Select(Function(r) String.Join(",",r.ItemArray)))
Regards,
Rhys18
(Rizky Albert Hartono)
September 5, 2022, 4:39am
5
@Gokul001 @Sanjit_Pal
Hi,
Is there any other way other than using dictionary? Because I feel like maybe with string.join or append or concat will do?
Rhys18
(Rizky Albert Hartono)
September 5, 2022, 4:40am
6
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
Yoichi
(Yoichi)
September 5, 2022, 4:46am
7
Hi,
In this case, perhaps you should use List<String>
and AddToCollection activity as the following.
Regards,
Rhys18
(Rizky Albert Hartono)
September 5, 2022, 4:51am
8
What is the someCollection var in the for each?
Thanks
Yoichi
(Yoichi)
September 5, 2022, 4:56am
9
HI,
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.
Regards,
Rhys18
(Rizky Albert Hartono)
September 5, 2022, 5:15am
11
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 !
Yoichi
(Yoichi)
September 5, 2022, 5:16am
12
Hi,
For now, can you try to move Assign : list_license = New List(Of String)
from inside If activity to just before ForEachRowinDataTable activity?
Regards,
Rhys18
(Rizky Albert Hartono)
September 5, 2022, 5:23am
13
I just tried this, It’s working as expected too… Thanks for the help !!
1 Like