How to access specific items from a delimited list

How to access specific items from a delimited list

Cycle 2.5 introduced a new step that will retrieve a specific item from a delimited list and assign to a variable.

The step is , I assign <NUMBER> <st|nd|rd|th> item from "<DELIMITER>" delimited list "<LIST>" to variable "<VARIABLE_NAME>"


The step requires a numbered index into the list, a delimiter and the list itself. These values can be provided directly to the step or assigned as variables and used in the step.


If you are looking to get the 3rd day of the week with the days separated by commas the step would look like:

Given I assign 3 rd item from "," delimited list "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday" to variable "day"
Then I echo $day

The expected result is Wednesday.

To employ variable replacement using the same example:

Given I assign 3 to variable "item"
And I assign "," to variable "delimiter"
And I assign "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday" to variable "list"

When I assign $item rd item from $delimiter delimited list $list to variable "day"
Then I echo $day

The expected result is again Wednesday.


  • The delimiter is not restricted to comma. Most non-operational related characters can be specified as a delimiter to fit your application.
    • Using a unsupported delimiter will produce an error similar to:mceclip1.png
  • Delimiter is actually a regular expression so if you were to get an error similar to above try putting brackets [] around your delimeter. Ex. [+].
  • The ordinal <st|nd|rd|th> is required but is used mainly for readability. If using variables you may not know in advance which ordinal "reads" the best but as long as one is specified in the step then the step will function properly.
  • If the delimiter specified in the step is different than the delimiter in the list, the whole list will be considered index 1.
    • Example
      • I assign 1 st item from "-" delimited list "red,blue,green" to variable "color"
        • Returns: red,blue,green
    • Another way to think about this is any string, including empty, satisfies an index of 1 regardless of delimiter.
  • Attempting an index out of bounds will produce this error in Cyclemceclip0.png
    • Related Articles

    • How to control Blue Yonder WMS authorization of Cycle MOCA connections

      Problem When connecting Cycle to a Blue Yonder WMS, it may be necessary to limit Cycle's access. Solution The Cycle MOCA connection step, I connect to MOCA at "<ADDRESS>" logged in as "<USERNAME>" with password "<PASSWORD>" includes a check of the ...
    • How To Access the Cycle E-Learning Platform (Cycle University)

      The Cycle User Portal was retired with the release of Cycle 2.9.2. The former Cycle E-Learning platform was retired along with the Cycle User Portal. Training materials can be found in the new Cycle University platform. Cycle Labs - Cycle University ...
    • How to use Web API steps

      Web API steps introduced in Cycle 2.5 can be used to send HTTP requests to exposed web API endpoints. The Cycle Web API steps support POST and GET request methods using the JSON data format. Cycle also includes steps for handling HTTP responses ...
    • How to use MOCA Examples as a Scenario Outline data source

      With the enhancements to Scenario Outlines, it is now possible to use multiple sources for test parameter data. Previously, parameters were set in the Feature in an Examples section specified and maintained by the user. The addition of Example Row, ...
    • How to store Connections and Credentials in Cycle

      Cycle includes the ability to save Connections and Credentials for your systems under test. Using named Connections and Credentials streamlines and simplifies declaring system access, makes Features look cleaner and promotes reusability of “set it ...