Helo everyone, I am still new and need guidance. I need to insert all of my email address into String from dataTable. How could I do this? My table looks like this.
First thing I did was using the Read Range. Then created the arrEmail as String of array and assign the value into the array inside the for each row but I got error like this.
Thanks in advance.
Hello @kristoff, you’re close. Is there a reason you need to use array (arrEmail)? If you really need the array then that is also possible but first you need to use a list of string, lets name it listEmail. You need to initialize the list in the Variables panel by assigning it’s default value to New List(Of String). Then inside the Body of your existing For Each Row, replace the assign with Add To Collection. Collection is your listEmail and item is row(5).ToString. Then after your For Each row use an assign activity, to: arrEmail value:listEmail.ToArray
DataTabletoArray.zip (23.7 KB)
Please find the attached workflow for your reference,
Hope this helps,if it works, mark it as solution.
You can also use linq within Assign Activity and without using ForEachRow Activity for the same as below :-
Object emailsInArray = (From emails in datatableVar Select emails(colIndexwithoutDoubleQuotes Or columnNamewithinDoubleQuotes)).ToArray
One Dummy workflow for the same :-
MainPratik.xaml (8.7 KB)
New Microsoft Excel Worksheet.xlsx (8.9 KB)
Also the error you are getting in your workflow is because your “arrEmail” variable is of Type Array of String
And 1st of all array is a collection and is of static size so you should use List<> of String instead of Array of String
And for adding the Emails/Value/Elements to the List you can use “Add to Collection” Activity
Mark as solution and like it if this helps you
Er Pratik Wavhal
Thanks a lot you help me so much.
Thanks @Latika10011740 for your help
Thank you for your guidance @avejr748.
You are Welcome
Er Pratik Wavhal
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.