Problem iterating with a for each loop

Hello to everyone!!

I’m used to working with loops, but this time, something is happening and I can’t understand why.

Here my sequence:

1 - Collecting data from AS400 with this structure:
image

image

Converting it into an Array List
image

Now:
image

Now I’m trying to iterate over it


image

The Output is:
image

Why the name is not coming up?
The message box is only sending to me the variable type.

What I’m missing here?

Thank you

Hi

In the final message box mention as

NomeOutout(1).ToString

We need to mention the index

Cheers @Andre_Vieira

2 Likes

adding toString() to variable of datatype Array(Of xxx) will return the datatype info

In case of you want the to display the content of the array you can do following:
String.Join(" | ", YourArrayVar)

feel free to replace the " | " by any string used as seperator. With Environment.NewLine the items can be seperated within new lines (Linebreaks)

In case of inspection, if the implementation is working as expected we would suggest to work with debuging, brekapoints, locals/watch/immediate panel as trained in the Debugging course from the UiPath Academy

1 Like

Hello Dear Palaniyappan

I tried it

This is the current output:
Palaniyappan

Ok, is better the receive System.String ahahah

What I’m doing wrong?

1 Like

Wait
I got it

In the assign just keep like this
Split(item,”:”)

Remove .Tostring

@Andre_Vieira

1 Like

@Andre_Vieira
as described above
grafik

1 Like

image

:sweat_smile:

Aaah

See there are either two way

If you want to keep the NomeOutout as a string then expression should be like this

NomeOutout = Split(item,”;”)(1).ToString

Better mention this inside the for each loop as I believe you have kept NomeOutout as string variable
And just mention as NomeOutout.ToString in message box

Or

If you have kept the NomeOutout variable type as array of string then expression will be

NomeOutout = Split(item,”;”) and continue in the same way as you have now

Cheers @Andre_Vieira

1 Like

Hello dear ppr.
Great explenation.

Let me see if I can solve it with Palaniyappan. If can’t I’ll try it in your way :wink:

My Dear!

It worked exactly how I want it.
Thank you a lot for your time.

Have a nice day

Cheers

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