How to pick each one value from an array

Hi, I have an array like example below. But I need first value and second value and third value sequentially. When I tried for each it is printing differently.

Array example : {‘one’, ‘two’, ‘three’}

I’m getting output when I use for each is:
One
One
Two
One
Two
Three

But I need to assign each time to a variable
And output should be like
One
Two
Three

Pls help

@Sudheer_Kumar_S

in for loop in argument give {"One","Two","Three"}

and inside loop usecurrentItem in the log…it would give exactly as you need

cheers

@Sudheer_Kumar_S

If you use for each, it will only print one time.

Var = Currentitem.tostring

Check if you are printing the variable two times or one time.

Hi @Sudheer_Kumar_S

input={"One","Two","Three"}

Refer the below Image


image

Uploaded the workflow xaml for reference
Sequence9.xaml (6.7 KB)

Hope it helps!!

Hi @Sudheer_Kumar_S

Try this

I hope it helps!!

Hey @Sudheer_Kumar_S Refer this
Testing.zip (2.5 KB)

You can try putting it in a for each loop with the array as list of items and printing it or you can join it and print it.

  1. Using for Each loop:-

  2. String Join:-

The XAML used:-
Main.xaml (8.0 KB)

Hi everyone… I’m appending that particular array that is why it is taking
Like

One
One two
One two three

Any idea how to take last one as an array and apply the logic you guys mentioned

@Sudheer_Kumar_S

If it’s an array try like this:
res = MyArray.Last

If it’s string:
res = MyStr.Split(" ").Reverse()(0)

1 Like

Hi @Sudheer_Kumar_S

Check out the below workflow and hope it meets up your requirement.
Sequence9.xaml (8.6 KB)


image

Hope it helps!!
Regards,

Thank you Supriya… it’s working now able to keep it in variable

1 Like

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