paul.crawford

Collection Operation - Get

Blog Post created by paul.crawford Champion on May 26, 2016

I was asked this question by Daniel Mueller and thought it was worth sharing

 

I have a string stored in a variable looking like this: name, email, username

I'm using the regular expression to split the string and storing the result in a collection variable (lets name it collection).

So from my understanding it should look like this now:

collection[0] = name

collection[1] = email

collection[2] = username

 

So I only want to use the second variable (email) in that collection and put it into an email field for example how do I do that?

From my understanding there must be something like this: ID1 collection but I dont know how to extract that.

 

Isn't the collection an array of variables?

 

I read the whole guide of "how to use a collection" but this didnt answer my question.

 

The Collection Operation action allows you to interact with a Collection Variable and specifically the Get operation allows you to access a specific index of that collection. In Daniel Mueller case the second index.

 

If the second index of your array is always the email, create a number variable with a default value of 1.

Capture.PNG

Then add a collection operation configured as below

Capture.PNG

This will then store the email address in the vTextEmail variable and you can now use this as you need.

 

All that would need to change would be the value set in the first vNumIndex variable to get the index of the collection required.

 

This document was generated from the following discussion: Collection variable get specific item

Outcomes