About Action Mapping XQuery Expressions

This topic describes how to use the Mapping Rule editor, Mapping tab, Actions subtab Action Mappings area, XQuery subtab to write an expression that defines the mapping for an action code for a particular mapping rule. To access this field, you must deselect Use Relationship Action Map and select the Advanced option.

  • Context: The input document is a source order item.

  • Prolog: You can declare the following variables within the prolog to determine the action code.

    • You can declare $sourceValue to access the action code of the source order item. This is the Order Item Action property value for the source order item.

    • You can declare $currentTargetValue to access the action code of the target order item. This is the Order Item Action property value for the target order item.

  • Body: The XQuery body returns an action code, or returns () to leave the current value unchanged.

The following example shows an XQuery expression that returns the source action code if the target action code is not already set and otherwise leaves the target action code unchanged.

		declare $sourceValue external;
	declare $currentTargetValue external;
	if (! fn:empty($currentTargetValue)) 
	    $sourceValue
	else 
	   ()