DECLARE
Does one of the following:
- Declares a global variable. A global variable is independent of any document.
- Declares an array and the number of elements in the array. The elements of array %%AR are referenced as %%AR[0], %%AR[1], etc. Array indexing is zero based. For example, if you declare an array with an arraysize of 5, valid indexes would be 0, 1, 2, 3, 4.
Note: DECLARE should only be used in the START section of the Rule File.
You must assign the result of the DECLARE function to a variable even though you will not actually use the result. All EngageOne™ Enrichment functions must have their results assigned to a variable.Syntax
DECLARE(varname, property, arraysize)
Arguments
Argument | Description | Default |
---|---|---|
varname | The name of the variable of which property is being set. | None |
property | Defines the nature of the variable. There are two variable properties that may be used: A (Array) or G (Global). Use of "A" requires the arraysize argument. | G |
arraysize | Specifies the number of elements in the array. The arraysize argument is not allowed if property is "G". | None |
Results
Result | Description |
---|---|
Return | 0—If valid property value is identified. -1—If property value is not identified. |
%%RC | Always set to 0. |
%%RM | Always a null string (''). |
%%RV | Always set to 0. |
Examples
Function Call | Return |
---|---|
%%MyVariable = DECLARE(%%TOT, 'G') The Value of the variable is the last one set, not the value that was associated with the document the first time. |
0 /* property value is valid*/ |
%%MyVariable = DECLARE(%%FOO, 'E') |
-1 /*'E' is an invalid property value*/ |
%%MyVariable = DECLARE(%%Var, 'A', 6) With the example above, which declares an array named %%Var, you can do the following:
|
0/* property value is valid*/ |
%%MyVariable = DECLARE(%%TOT, 'A', %%arrsize)
Command line example: |
0 |
%%Var = ' ' This will initialize all elements of %%Var to ' ' |