Adding rules to the ExportXML ruleset
To export line item grid data to an XML file, you must add the appropriate rules to the ExportXML ruleset.
Procedure
Adding rules to the ExportXML ruleset:
- In the Datacap Studio Rulesets pane, select the ExportXML ruleset and click Lock/Unlock ruleset for editing.
- Right-click the ExportXML ruleset and choose Add Rule. Rename the new rule Export Other XML Page Node.
- Right-click the ExportXML ruleset and choose Add Rule. Rename the new rule Export Other XML Line Item.
-
Right-click the ExportXML ruleset
and choose Add Rule. Rename the new rule Export
Other XML Total Cost.
The ExportXML ruleset includes the following rules:
- Open XML File
- Export Rental Agreement XML
- Export Other XML Page Node
- Export Other XML Line Item
- Export Other XML Total Cost
- Close XML File
- Expand the Open XML File rule and the Open XML function.
- Click the Actions library tab and expand the Export XML library.
-
Select and add each of the following actions that are shown
in the following table to the end of the Open XML function
by clicking Add to function. Then, set the
action parameters as shown in the second table.
Action Parameter xml_NewNode Car_Rentals,BatchID_+@BatchID xml_NewNode Rental_Agreements,Car_Rentals xml_NewNode Flights,BatchID_+@BatchID xml_NewNode Hotels,BatchID_+@BatchID xml_NewNode Other_Charges,Hotels - Expand the Export Other XML Page Node rule and select Function1.
-
Select and add each of the actions that are shown in the
following table to Function1 by clicking Add
to function. Then, set the action parameters as shown
in the table.
Library Action Parameter ExportXML xml_NewNode @ID,Other_Charges rrunner rrSet
(do not use rr_Set)
varSource = @ID
varTarget = @P.ID
Important:xml_NewNode("@ID,Other_Charges")creates a new XML node by using the ID of the current page (for example,<TM000013>) beneath the<Other_Charges>node.rrset("@ID","@P.ID") stores the ID of the current page in a variable that is called ID within the runtime hierarchy (for example,
<V n="ID">TM000013</V>. - Expand the Export Other XML Line Item rule and select Function1.
-
Select and add each of the actions that are shown in the
following table to Function1 by clicking Add
to function. Then, set the action parameters as shown
in the table.
Library Action Parameter ExportXML xml_NewNode Item,@P.ID ExportXML xml_SetAttributeValue Item,Category,@F\Category ExportXML xml_SetAttributeValue Item,Cost,@F\Total Important:xml_NewNode("Item,@P.ID")creates a new node<Item>that is a child of the node that you created in the Export Other XML Page Node rule. The@P.IDparameter identifies the parent node by using the ID variable of the page that you saved earlier by usingrrset. You cannot reference the ID of a parent object by using a smart parameter.xml_SetAttributeValue("Item,Category,@F\Category")creates aCategoryattribute on the current<Item>node and sets the value to the value of the current line item'sCategoryfield (for example,<Item Category=Internet/>).The
xml_SetAttributeValue("Item,Cost,@F\Total")parameter is the same except that the attribute isCostand the value is the current line item'sTotalfield (for example,<Item Cost="9.90"/>. - Expand the Export Other XML Total rule and select Function1.
-
Select and add each of the actions in the following table
to Function1 by clicking Add to
function. Then, set the action parameters as shown in
the table.
Library Action Parameter ExportXML xml_NewNode Total_Cost,@P.ID ExportXML xml_SetNodeValue Total_Cost, @P\Other_Charges_Total Important:xml_NewNode("Total_Cost,@P.ID")creates a new XML node that is called<Total__Cost>beneath the page node that you created in the Export Other XML Page Node rule. Thexml_SetNodeValueaction sets the value of this node to the value of the current page'sOther_Charges_Totalfield (for example,<Total_Cost>$238.75</Total_Cost>). - In the Rulesets pane, click Save. Then, click Lock/Unlock ruleset and choose Publish ruleset.