Skip to content
v2.7 (latest)

Create an array Input ​

This guide explains how to create an array input for a ruleset.

About array inputs ​

An array input contains a one-dimensional array of values. For example:

json
{
  "AgeScale": [
    6,
    12,
    18
  ]
}

Create an array input ​

Let's say you need to process a sequence of 6 test scores for each participant in a course.

  1. Open the ruleset where you want to create the input.
  2. Click the + sign behind Input from the left menu.
    ↳ The Input details page opens.
  3. In the Name field, enter TestScores.
  4. In the Type list, select array.
    ↳ Rulecube adds the Sub type setting to the details page.
  5. Leave the Sub type list to number.
  6. Click Advanced settings and select the Required checkbox.
  7. In the Min. length field, enter 6. And do the same for Max. length.
  8. Select the Strict checkbox.
    ↳ Now the array requires exactly 6 test scores (elements).
  9. Click Save.

How to address an array element ​

You can select a specific array element by its index, like in the following example:

javascript
TestScores[2]

Be aware that the array index starts at 0 for the first element. So, the example selects the third score from the array.

Additional resources ​