Creating Arrays in Creator

Arrays are variables but they differ from other variables in that contain more than one value at a time. There are two ways that you can create Array variables in Creator and then add the contents, they are:

(i) Using the New Variable dialog and Set Variable Array action – this method allows you to create Array variables by filling-in information in familiar dialog boxes.

(ii) Using OpusScript – this method creates arrays using the OpusScript programming language.

Whichever method you use to create an Array variable, the information can be displayed on a page in a Text object so the user can see the contents. However, often arrays are created in OpusScript purely to calculate other functions in a script and may never be shown to or used by a user.

Note:
For a further discussion on Array variables and other types of variables, such as Publication and Page variables – see Types of Variables for more information.

Creating an Array and adding contents with dialog boxes:

1. Use the New Variable dialog to create an Array variable. This will create the Array itself but it does not actually allow you to fill-in the values for each element that make up the Array variable. In other words, you have created the structure but not the contents of an Array variable.

Note:
For a full description on creating variables – see Creating Variables for more information.

2. Use the Set Variable Array action to add the values to an element of an Array variable. The Set Variable Array action only allows you to set the value of one element at a time. Therefore, if you have 30 elements in an array, you will have to use the action 30 times.

Note:
For a full description on using this action – see Set Variable Array action for more information.

3. The Set Variable Array action is used to add the initial value of an element in an Array variable and also whenever you want to change the value of an element. You can change the values of individual elements at any time and this will not affect the contents of other elements in the Array variable.

Related Topics:

Types of Variables

Creating Variables

the Set Variable Array action

Overview of Variables in Creator