Was this helpful?
Dim Statement
 
Description
Dimension local variables
Syntax
Dim variablename
Remarks
The Dim statement uses the variablename argument.
Use Dim in a function procedure to declare variables that are local to that procedure. Put your Dim statements at the beginning of the procedure.
You must declare an object type, such as DJImport.
Limitation
There is no limitation of on the number of Private-level variables. In most statements, Dim declares a Private-scoped variable.
When used with a user-defined function, Dim create a function-scoped variable.
Example
This example uses the Dim statement to declare a variable in an expression, where "Result" is the variable name. The If Then Else statement is looking for Result A, else if Result A is not true, then a Null is returned:
Dim Result
Result = UCase(Left(FieldAt("/SOURCE/R1/Field1"), 1)
If Result == "A" Then
  Result = UCase(Left(FieldAt("/SOURCE/R1/Field1"), 1)
Else
  Result = ""
End If
Result
Note:  The Dim statement creates a local variable. This means that the Dim variable is local to the expression in which it is defined. So, if you create a variable using the Dim statement in one step, it is invisible to the all of the other steps in the transformation.
Last modified date: 08/02/2023