This topic describes how to use the Order Item Specification editor, Order Item Dependency tab, Order Item Selector area, XQuery tab to write an expression that creates dependencies between order items across orders.
Context: The Order Item Selector XQuery input document is typically an order item on a follow-on order (the waiting order).
Prolog: You can declare the OSM namespace, the cartridge namespace for the target order, and the namespace of the task that contains the data you want to query. For example:
declare namespace osm="http://xmlns.oracle.com/communications/ordermanagement"; declare namespace im="CommunicationsSalesOrderFulfillmentPIP"; declare namespace osmc="urn:oracle:names:ordermanagement:cartridge: CommunicationsSalesOrderFulfillmentPIP:1.0.0:view:CommunicationsSalesOrderQueryTask";
Body: The XQuery body returns the order ID of the target order and the order item property:
<osm:dependency fromOrderId="{$parentOrderId}" fromOrderItemId="{$parentOrderItemId}"/>
where
<osm:dependency fromOrderId: Returns the target order ID.
fromOrderItemId: Returns the target order item property value that controls the dependency.
The following example shows an XQuery for an inter-order dependency.
declare namespace ord="http://xmlns.oracle.com/communications/ordermanagement"; declare namespace im="CommunicationsSalesOrderFulfillmentPIP"; declare namespace osmc="urn:oracle:names:ordermanagement:cartridge: CommunicationsSalesOrderFulfillmentPIP:1.0.0:view:CommunicationsSalesOrderQueryTask"; let $dependingLineId := fn:normalize-space(osm:properties/im:DependingSalesOrderBaseLineId) return if(fn:not($dependingLineId = '')) then (: Use the data instance behavior "findOrder" to find the base order: :) let $parentOrderId :=fn:normalize-space(vf:instance("findOrder")/ord:Order[last()] /ord:Amendments/ord:AmendedOrderSummary/ord:Id/text()) (: Use the data instance behavior "getOrder" to find the associated order item ID in the base order: :) let $parentOrderItemId := fn:normalize-space(vf:instance("getOrder")/ord:Data/ osmc:_root/osmc:ControlData/osmc:OrderItem[osmc:BaseLineId=$dependingLineId]/@index) return if(fn:not($parentOrderId = '') and fn:not($parentOrderItemId = '')) then (: Return the dependency: :) <osm:dependency fromOrderId="{$parentOrderId}" fromOrderItemId="{$parentOrderItemId}"/> else() else()