Lagra Automations

Understanding Query XML Nintex Workflow Action Outputs

Using Nintex 2016 Form & Workflow and SharePoint 2016, this article will enable you understand Nintex workflow Query XML action outputs. For a sample project that used this action, please see this article.

The XML we will be exploring is as seen below:

<?xml version=”1.0″ encoding=”utf-8″?><RepeaterData><Version /><Items><Item><Task type=”System.String”>Change the light bulb</Task><Status type=”System.String”>New</Status></Item><Item><Task type=”System.String”>Clean the workshop</Task><Status type=”System.String”>In Progress</Status></Item><Item><Task type=”System.String”>Repair the door handle</Task><Status type=”System.String”>In Progress</Status></Item><Item><Task type=”System.String”>Clean the windows</Task><Status type=”System.String”>Completed</Status></Item></Items></RepeaterData>

Using Code Beautiful, it looks like the below:

Exploring the Query XML Action

For all images stipulated below use the numbers as guide to all the steps that should be taken.

Add a Query XML Action that queries the SharePoint list column and stores the output in the listitems collection variable as shown in the image below.

Nintex Workflow query action
Qwery XML image

You can test the output of the XML query without having to publish your workflow by using the “Run Now” button in step 1.

Step 6 shows that the results of the query can be outputted in 3 ways. They are:

  1. Text
  2. Inner XML
  3. Outer XML
Text Output and Analysis

The text output combines the “Task” and “Status” values into a single string, separated by the word “New,” “In Progress,” or “Completed.”

Output 1
Change the light bulbNew
Clean the workshopIn Progress
Repair the door handleIn Progress
Clean the windowsCompleted

Implications:
If you process this text representation in a loop, you’ll need to split each line to extract the “Task” and “Status” information.
You can split the line using the word “New,” “In Progress,” or “Completed” as a delimiter.
For each line, you’ll get a single string containing both the task and status. You’ll need to further split this string to separate the task and status.

Inner XML Output and Analysis

The inner XML output provides the complete XML structure for each “Item,” including both the “Task” and “Status” elements.

Output 1

<Task type=”System.String”>Change the light bulb</Task><Status type=”System.String”>New</Status>
<Task type=”System.String”>Clean the workshop</Task><Status type=”System.String”>In Progress</Status>
<Task type=”System.String”>Repair the door handle</Task><Status type=”System.String”>In Progress</Status>
<Task type=”System.String”>Clean the windows</Task><Status type=”System.String”>Completed</Status>

Implications:
If you process this inner XML representation in a loop, you can directly access the “Task” and “Status” elements as separate XML nodes.
You’ll need to extract the content within the <Task> and <Status> tags for each item.
This representation is more structured and easier to work with programmatically.

Outer XML Output and Analysis

The outer XML representation provides the complete XML structure for each “Item,” including the surrounding <Item> tags.

Output 1

<Item><Task type=”System.String”>Change the light bulb</Task><Status type=”System.String”>New</Status></Item>
<Item><Task type=”System.String”>Clean the workshop</Task><Status type=”System.String”>In Progress</Status></Item>
<Item><Task type=”System.String”>Repair the door handle</Task><Status type=”System.String”>In Progress</Status></Item>
<Item><Task type=”System.String”>Clean the windows</Task><Status type=”System.String”>Completed</Status></Item>

Implications:
If you process this outer XML representation in a loop, you’ll need to extract the content within each <Item> tag.
For each item, you can then access the “Task” and “Status” elements separately.
This representation maintains the hierarchical structure of the XML data.

Summary:

If you want a straightforward way to access the “Task” and “Status” elements, use the inner XML representation.
If you prefer a more human-readable format, use the text representation and split the lines.
The outer XML representation is useful if you need to maintain the complete XML structure.

Leave a Reply

Your email address will not be published. Required fields are marked *