# Assign

The Assign section is probably one of the more complex pages in the BPEL Designer, due to the nature of the BPEL Assign activity. The figure below shows the detail tab of an empty Assign activity with callouts describing each component:

Assign

1. List (initially empty) of assignment operations currently defined.
2. From combo box for selecting the source element category.
3. To combo box for selecting the target element category.
4. Contents and order management buttons. The New button adds a new assignment operation to the list. When clicked, the From and To combo boxes become active and display Variable. These allow you to select the source and categories for target items.
5. Validate checkbox: when enabled will cause the BPEL engine to validate the data after the assignment. If an error is detected it will cause a fault, which can be caught by a fault handler in the BPEL process.
6. Ignore Missing Source Data checkbox ; When enabled, missing source data is not considered an error (no fault will be generated).
7. Keep Source Element Name checkbox: when enabled, the complex target variable element names will not be replaced by the source element names if they differ.

The following figure shows the detail tab of an Assign activity which has an XPath expression as the source ( From ) and a process variable element as the target (To):

Assign

A requirement of the BPEL language is that all complex variables must be initialized with valid XML before they are referenced either as a target of an assignment, or in another BPEL activity. The BPEL Designer understands this and, once you have selected the target of an assignment operation, it will ask if you would like to have an XML fragment generated for the target variable:

Assign

Unless you are certain that the variable has been initialized during a previous assignment operation or other activity, you should click Yes . The figure below shows the Assign details tab after the initializer has been generated:

Assign

##### Assignment Operation Categories

Additional type selection or data entry widgets will appear below the From and To combo boxes, depending on the source and target item categories selected in the combo boxes. Initially these will be controls for the selection of process variables, since the default combo box selection is Variable. The possible source and target categories are described in the following table:

Possible source and target categories

Category | Control type | Can be source? | Can be target? | Further information
--- | --- | --- | --- | ---
Variable | Tree | Yes | Yes | Select an in-scope variable or any portion if it is a complex variable. The target of the assignment must have the same type (for simple variables) or structure (for complex variables) as the source.
Expression | XPath | Yes | Yes | Enter a valid XPath expression with the XPath editor. For targets, the expression must resolve to an L-Value; that is, it must be a variable reference.
Fixed Value | Text | Yes | No | Enter a valid XML fragment that is compatible in structure and data type with the target.
Property of a Variable | List | Yes | Yes | N/A
Partner Link reference | List | Yes | Yes | N/A
Endpoint reference | List | Yes | No | N/A
Opaque | None | Yes | No | N/A