I have array of string, i want to show all this string in one message box

when i run the program, i got one by one message of array.
i want to show all this in one message box.

Hi,
Instead of for loop
In Message box give it like array(0),array(1), …array(length-1).

Let us know if this helps,

Just curious why do you need that.

Regards,
Pavan H

5 Likes

@priyesh

Use message box outside of the loop and pass like this:

Name(0).Tostring+" "+Name(1).Tostring…

6 Likes

you don’t need to put the message box in for each activity. just follow use a message box with the steps mentioned by @pavanh003

3 Likes

Hi @priyesh

No need to use any loop to get all array values into a string. There is a function String.Join(“,”, Name) which gives a single string value. Attached sample workflow for your reference.

Hope this will help you.

Sample.xaml (7.5 KB)

Regards,
Vijay

7 Likes

Yes it is helpful, But if we have bundles of data.

Hey @priyesh

The above code which i shared that will work for any number of items. Can you please check it and confirm it is working with bundles of data ??

Regards
Vijay.

I hope this helps you.


  1. Convert “Name(Array)” to “List_Name(List)”
    List_Array=Name.toList

  2. Convert “List_Name” to “String_Name(String)”
    String_Name=String.Join(“,”,List_Name)

  3. Remove indention
    String_Name=strName.Replace(" “, string.Empty).Replace(vbTab, string.Empty).Replace(vbLf, string.Empty).Replace(vbCr, string.Empty).Replace(” ", string.Empty)

  4. Show it at MessageBox
    String_Name


1 Like

C#? how to do?

This is how I displayed all items from a list in a single message box when using C#:
“Names in List: " + string.Join(”, ", NamesList);

Hi @Priyesh,
By using Aggregate operation, You can show the String array in Message box without using For each, Kindly find the below solution

StrArray = {“Apple”,“GooglePixel”,“Samsung”,“Oneplus”}

StringVariable = StrArray.Aggregate(Function(a,b) (a+“,”+b))

image
Regards,
KarthickKumaran

1 Like

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