define (variable) as (value)

The define construct creates a variable that you can use to perform actions.

Purpose

You use this construct in the action part of a rule to create a temporary local variable.

Syntax

define <variable> as (<object> | <list>)

Description

The define <variable> keyword defines the name of the new variable. You cannot use this construct to set a value for an existing variable. The as <variable value> keyword defines the object that the variable refers to. The variable stores the object locally. You can then use this new variable in the rule action.

Example

In the following example, you define a new variable called new order. This new order is created from the shipping address and the billing address of the customer.

define 'new order' as a new order where 
	the shipping address is the shipping address of Customer,
	the billing address is the billing address of Customer ;

You can also use the define <variable> as <variable value> construct with the a copy of <object> where <attribute> is <value> construct to create a new variable. The following action creates a new variable called the new address.

define 'the new address' as a copy of the address of customer where the street is "Victor Hugo" ;