Gets a unique number for a variable which belongs to a sequence of variables.
VariableGetUniqueNumber([Variable Prefix],[Variable Suffix], [Variable Index])
Where:
Variable Prefix is the name of the variable that appears before its number.
Variable Suffix is the name of the variable that appears after its number.
Variable Index is the number of the variable for which to calculate the unique number.
The sequence of numbers used in the variable names must run consecutively, without any numbers being skipped.
Variable Prefix and Suffix values are not case sensitive.
Variables that result in text strings are also not case sensitive.
This function will search in all categories and sub-categories for variables that match the specified prefix and suffix values.
Refer to Variable Names table below
Rule | Result | Why? |
---|---|---|
VariableGetUniqueNumber("Var","",1) | 1 | Because "Hello" is the first unique value in the sequence of variables running from Var1 to Var 1 |
VariableGetUniqueNumber("Var","",2) | 2 | Because "World" is the second unique value in the sequence of variables running from Var1 to Var 2 |
VariableGetUniqueNumber("Var","",3) | 1 | Because "Hello" was already assigned the number 1 in the sequence of variables running from Var1 to Var 3 |
VariableGetUniqueNumber("Var","",4) | 3 | Because "John" is the third unique value in the sequence of variables running from Var1 to Var 4 |
Variable Name | Value |
---|---|
Var1 | "Hello" |
Var2 | "World" |
Var3 | "Hello" |
Var4 | "John" |
Refer to Variable Names table below
Rule | Result | Why? |
---|---|---|
VariableGetUniqueNumber("Item","Qty",1) | 1 | Because 8 is the first unique value in the sequence of variables running from Var1 to Var 1 |
VariableGetUniqueNumber("Item","Qty",3) | 3 | Because 18 is the third unique value in the sequence of variables running from Var1 to Var 3 |
VariableGetUniqueNumber("Item","Qty",4) | 2 | Because 12 was already assigned the number 2 in the sequence of variables running from Var1 to Var 4 |
VariableGetUniqueNumber("Item","Qty",5) | 4 | Because 27 is the fourth unique value in the sequence of variables running from Var1 to Var 5 |
Variable Name | Value |
---|---|
Item1Qty | 8 |
Item2Qty | 12 |
Item3Qty | 18 |
Item4Qty | 12 |
Item5Qty | 27 |