Creating the ExportXML ruleset

You use Datacap Studio to create the ExportXML ruleset. Also, the ruleset requires three rules.

About this task

Three separate rules are required.

  • One rule that is attached to the Open element of the batch to set the XML export path and file name.
  • One rule that is attached to the rental agreement page that writes the data for the current page.
  • One rule that is attached to the Close element of the batch to save the XML file.

Procedure

To create the ExportXML ruleset:

  1. In the Rulesets pane, right-click the TravelDocs node and choose Add Ruleset.
  2. Rename the new ruleset from Ruleset1 to Export XML.
  3. Rename the default rule from Rule1 to Open XML File.
  4. Rename the default function from Function1 to Open XML.
  5. Click the Actions library tab and expand the Export XML library.
  6. Select and add each of the following actions that are shown in the following table to the Open XML function by clicking Add to function. Then, set the action parameters as shown in the following table.
    Action Parameter
    xml_SetExportPath @APPPATH(export)
    xml_SetFileName @BatchID
    Attention: @APPPATH(export) is a smart parameter that gets the export path from the application configuration file. @BatchID is a smart parameter that returns the current batch ID.
  7. Right-click the ExportXML ruleset and choose Add Rule.
  8. Rename the new rule from Rule1 to Export Rental Agreement XML.
  9. Rename the default function from Function1 to Export XML.
  10. Select and add each of the following actions that are shown in the following table to the Export XML function by clicking Add to function. Then, set the action parameters as shown in the following table.
    Action Parameter
    xml_NewNode @ID,Rental_Agreements
    xml_NewNode Pickup_Date,@ID
    xml_SetNodeValue Pickup_Date, @P\Pickup_Date
    xml_NewNode Pickup_Location,@ID
    xml_SetNodeValue Pickup_Location, @P\Pickup_Location
    xml_NewNode Return_Date,@ID
    xml_SetNodeValue Return_Date, @P\Return_Date
    xml_NewNode Return_Location,@ID
    xml_SetNodeValue Return_Location, @P\Return_Location
    xml_NewNode Car_Type,@ID
    xml_SetNodeValue Car_Type, @P\Car_Type
    xml_NewNode Options,@ID
    xml_SetNodeValue Options, @P\Options
    xml_NewNode Total_Cost,@ID
    xml_SetNodeValue Total_Cost, @P\Total_Cost
    Attention: @ID gets the ID of the current object. @P\ gets the value of the specified field on the current page.
  11. Right-click the ExportXML ruleset and choose Add Rule.
  12. Rename the new rule from Rule1 to Close XML File.
  13. Rename the default function from Function1 to Close XML.
  14. Select and add the action that is shown in the following table to the Close XML function by clicking Add to function. This action has no parameter.
    Action Parameter
    xml_SaveFile  
  15. In the Rulesets pane, click Save. Then, click Lock/Unlock ruleset and choose Publish ruleset. The finished ruleset looks like the following example.