Dim Statement (FPScript)

23.08.2021

Declares several local variables for a formula or declares one variable and assigns a value to it.

Syntax

Dim Name1[, Name2]...

or

Dim Name = Expression

Remarks

Before using a local variable in a formula, you must declare it using the Dim statement. If you are using a variable name in a formula, which does not exist as a data set in the project database, as a predefined constant, as a declared argument variable, as a loop counter, in a Catch statement or as a declared local variable, an error message occurs.

Use the second syntax if you want to declare a single variable and initialize it with a value at the same time.

The use of the Dim statement is optional if you have activated the option Define non-defined FPScript variable automatically on the FPScript tab in the dialog box Properties (Properties menu) of the project database. Using the automatic declaration is not recommended.

Available in

FlexPro View, Basic, Professional, Developer Suite

Examples

Dim A, B, C

Declares three variables A, B and C.

Dim Series = (100n, 0, 0.1)

Declares the variable Series and assigns a linearly increasing data series with 100 values to the variable.

Share article or send as email:

You might be interested in these articles