xmlCompare Step

Use this step to compare two XML data set.

Last published at: January 9th, 2024

Description:

This step compares two XML data sets and returns new items present in one data set and removed items from the second data set. 

 

Inputs

  • 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
 

 

Returns

  • 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 its values. 
  • Click on the button to define multiple variables and its values. Click on Add Row (+) button to add new variable name and its values. Click on Save button to confirm the action. 
  • The Xml data used for variable.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>
  • The Xml data used for variable.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 compare.
  • Save the process definition, create a process instance and execute. The process step should compares two XML data sets and returns new items present in one data set and removed 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 varGlobalXML1NewItems icon to view the new items after compare. Click on varGlobalXML2RemovedItems to view the duplicate items removed after compare.  
  • 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>