User variables

Campaign supports user variables, which can be used during process configuration when creating queries and expressions.

Guidelines for using user variables

The following guidelines apply to user variables:

  • User variables are local to the flowchart in which they are defined and used, but they have global scope within a flowchart run.
  • User variables use the following syntax: UserVar.UserVarName
  • User variables have Initial Values, which is the value assigned when a user variable is initially defined in the User variables variables dialog. The Initial value is only used to set the Current value before executing a flowchart run. It is the Current value that Campaign uses during a flowchart run.
    Note: If the Current® value for a user variable is not set and you execute a process run or a branch run, Campaign will not be able to resolve the user variable. Campaign only sets the Current value of a user variable to the Initial value before a flowchart run.
  • You can change the Current value of a user variable in the Derived Field window of a Select process.
  • User variables can be set to constants or to expressions, such as UserVar.myVar = Avg(UserTable.Age).
    Note: If you use an expression that returns multiple values (such as UserTable.Age+3, which will return one value for each record in the table), the user variable is set to the first value returned.
  • When using user variables within SQL statements, do not enclose user variables in quotation marks, either single or double.
  • If you pass object names to your database (for example, if you use a user variable that contains a flowchart name), you must ensure that the object name contains only characters supported by your particular database. Otherwise, you will receive a database error.
  • The values of user variables can be passed in on process execution.
  • User variables are supported in outbound triggers.
  • User variables are supported for use in custom macros.
  • You cannot rename a user variable in the following cases:
    • You created a derived field using the user variable in a flowchart process and saved or ran the flowchart or process.
    • You created the user variable in a flowchart process and published the flowchart to Distributed Marketing.