Latest News

the latest news from our team

Choose One Of

The ‘Choose One Of’ function can be used to choose a specific instance from an array by index or by matching against a parallel occurring variable. This function is particularly useful for extracting an item from an array of values.

Sample: First Item in an Array

The following example shows how to pull separate items from a group (a list) by the index. To follow along, download the files here:

Choose One Of

1. Right click ‘lines’ and select Add Variable.

2. The Variable dialog box displays. Select OK to continue.

3. In the Project Window, right click the form and select Add Variable > By position. Enter ‘line1’ in the Name field and select OK.

4. Right click the ‘line1’ variable from the Project Window and select Add Pre-condition Procedure > Set Variable. Enter ‘First’ in the Name field. From the Use variable field, select the ‘lines’ variable created earlier. Select OK.

5. The Set Variable Action dialog box displays. Select ‘line1’ from the Variable drop-down menu. Select OK.

6. Right click the procedure [First (lines)] and select Add Function > Choose one of. From the ‘Choices in variable’ drop-down menu, select the ‘lines’ variable created earlier. Select ‘Choose using index’ and from the ‘Index’ field select ‘Constant’ and enter the numeric value ‘1’ to retrieve the first value in the selected array. Select OK.

7. Left click and drag the “Choose one of” procedure(s) and place it above the “Set variable” action(s). It should like the following:

8. To retrieve additional individual items, repeat steps 3-6 as needed, adjusting the naming conventions as required. The results can be viewed in the Variables Window.

Leave a Reply

Your email address will not be published. Required fields are marked *