Description:
This step compares two XML data sets, returning new items present in one data set and removing items from the second data set.
Helpjuice Info Callout Title
- XML1 - Xml data set 1
- XML2 - Xml data set 2
- columnList - List of columns to compare
- varGlobalXML1NewItems - Variable/Global to store XML1 new items
- varGlobalXML2RemovedItems - Variable/Global to store XML2 removed items
Helpjuice Success Callout Title
- True – step executed successfully
- False – step failed to execute
Usage:
Example:
Let’s build and execute the “xmlCompareDef” example.
- Create a new definition called “xmlCompareDef”
- Select the definition and click the “design” button
- Drag an “UpdateVariables” and "xmlCompare" step to the canvas
- Connect the dots between the Start, “UpdateVariables” and "xmlCompare" step
- Define variables/globals to store XML data to compare
- Define variables/globals to store the comparison result (for both new and removed)
- Click on the "UpdateVariables" step to configure its “Settings” properties. Provide a name to the step.
- Click on the "UpdateVariables" step to configure its “Advanced” properties. Click on the button to define multiple variables and their values.
- Click on the button to define multiple variables and their values. Click on the Add Row (+) button to add a new variable name and its values. Click on the Save button to confirm the action.
- The XML data used for variables.varXML1 (for reference)
<SQLData>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>20</PROCUREMENTTYPEID>
<ROWNO>1</ROWNO>
<PROCESSID>eef9a64e-c2bb-4f4f-99df-a5201d841e42</PROCESSID>
<RowID>0</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>24</PROCUREMENTTYPEID>
<ROWNO>1</ROWNO>
<PROCESSID>a3784005-c8d6-43f1-b5bc-05583b9ea617</PROCESSID>
<RowID>1</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>36</PROCUREMENTTYPEID>
<ROWNO>1</ROWNO>
<PROCESSID>617b40af-2a9b-4ae0-8356-73410d2fb22c</PROCESSID>
<RowID>2</RowID>
</Row>
</SQLData>
T
- The XML data used for variables.varXML2 (for reference)
<SQLData>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>20</PROCUREMENTTYPEID>
<ROWNO>1</ROWNO>
<RowID>0</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>20</PROCUREMENTTYPEID>
<ROWNO>2</ROWNO>
<RowID>1</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>24</PROCUREMENTTYPEID>
<ROWNO>1</ROWNO>
<RowID>2</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>24</PROCUREMENTTYPEID>
<ROWNO>2</ROWNO>
<RowID>3</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>36</PROCUREMENTTYPEID>
<ROWNO>1</ROWNO>
<RowID>4</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>36</PROCUREMENTTYPEID>
<ROWNO>2</ROWNO>
<RowID>5</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>38</PROCUREMENTTYPEID>
<ROWNO>1</ROWNO>
<RowID>6</RowID>
</Row>
</SQLData>
- Click on the "xmlCompare" step to configure its “Settings” properties. Provide a name to the step. Provide the variable/global reference for XML1 and XML2. Provide the variable/global reference to store XML1 new items. Provide the variable/global reference to store XML2 removed items.
- Click on the "xmlCompare" step to configure its “Advanced” properties. Provide the common column names (comma-separated) to be used for comparison.
- The “Logging” setting configuration is necessary for documentation and also measures the workflow progress and the percent complete. This is achieved by configuring the step state and percent fields individually, as shown in the images below. Configure the “Logging” using the following properties.
- Save the process definition, create a process instance, and execute. The process step should compare two XML data sets, return new items present in one data set, and remove items from the second data set. Navigate to Administration - Run - Process Instance - select the process instance to render. Click on the xmlCompare step to view the properties. Click on the varGlobalXML1NewItems icon to view the new items after comparison. Click on varGlobalXML2RemovedItems to view the duplicate items removed after comparison.
- The XML result set for varGlobalXML1NewItems after compare (for reference)
<SQLData>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>24</PROCUREMENTTYPEID>
<ROWNO>1</ROWNO>
<PROCESSID>a3784005-c8d6-43f1-b5bc-05583b9ea617</PROCESSID>
<RowID>0</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>36</PROCUREMENTTYPEID>
<ROWNO>1</ROWNO>
<PROCESSID>617b40af-2a9b-4ae0-8356-73410d2fb22c</PROCESSID>
<RowID>1</RowID>
</Row>
</SQLData>
- The XML result set for varGlobalXML2RemovedItems after compare (for reference)
<SQLData>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>20</PROCUREMENTTYPEID>
<ROWNO>2</ROWNO>
<RowID>0</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>24</PROCUREMENTTYPEID>
<ROWNO>1</ROWNO>
<RowID>1</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>24</PROCUREMENTTYPEID>
<ROWNO>2</ROWNO>
<RowID>2</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>36</PROCUREMENTTYPEID>
<ROWNO>1</ROWNO>
<RowID>3</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>36</PROCUREMENTTYPEID>
<ROWNO>2</ROWNO>
<RowID>4</RowID>
</Row>
<Row>
<PROJECTID>9268</PROJECTID>
<PROCUREMENTTYPEID>38</PROCUREMENTTYPEID>
<ROWNO>1</ROWNO>
<RowID>5</RowID>
</Row>
</SQLData>