In a For Each I want to start with second string in Array

I am new to Uipath and tries to read and learn, but now I am stucked.
I have an array with several substring. First substring(0) does not contain any information I want so I want to start For Each at second string(1) and Loop to next and so on. I have managed to read all strings and build a data Table, but sinse the first string does not contain information I want it stops the execution. When testing the loop I used the Ignore button when it loops through string(0) so when it starts to read from string (1) it all goes fine.
Is there any way to exclude string(0) and go directly to string(1).

regards

2 Likes

@kare.smorvik

Try this.

     newArray [] = yourArray.Skip(1).Toarray

Outside for each?

@kare.smorvik

The above expression will skip the first item from array and will keep remaining all items.

Then use ForEach loop to iterate one by one element.

So like this in an Assign:
myArray=myArray.skip(1).toArray
Or maybe I need to make a myTempArray?

Yes it’s fine. After this assign, use ForEach loop and pass that myArray to iterate one by one item.

Fine
we can validate that for each element
like what if any of the element in the middle doesnt have any value
so in that case we can validate them like this
–use a for each activity and pass the arrray variable as input
–inside the loop use a IF condition like this
NOT String.IsNullEmpty(item.ToString)
Only if the above condition passes it will get into THEN part where we can have our current sequence of activities to be performed

hope this would helpyou
Cheers @kare.smorvik

Thank you, looks like it works fine

1 Like

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