cancel
Showing results for 
Search instead for 
Did you mean: 
akalmar
Nintex Newbie

Why would a workflow skip over a loop?

I created a basic workflow to extract the data in a repeating section.  However, every time I run it, the loop gets skipped over.  Here's what it looks like:

Graphical workflow history

I've confirmed that the variables within the loop have proper values.  In this case numItems = 3 and numIndex = 1.

Loop Action

Workflow comments

No errors come up during the process.  At the end, it looks like the workflow has completed.  However, it has skipped over the loop entirely.  Has anyone else encountered this?  Please let me know.  Thanks!

0 Kudos
Reply
8 Replies
rickbakker
Nintex Newbie

Re: Why would a workflow skip over a loop?

Loop: This workflow action runs a set of child actions while a condition evaluates to true. 

Based on your screenshots, the loop only runs when numIndex (1) equals numItems (3). Because they are not equal, the loop is not executed. I think you need to do something other than 'equals' (like 'less or equal').

Reply
Automation Master
Automation Master

Re: Why would a workflow skip over a loop?

reg. your question on loop action, ‌ is right.

but I wonder whether you need a loop at all.

query XML action allows to define as many xpath expressions as you need. so I don't need a reason for loop.

single query XML action with 3 xpath expressions is much more effective then loop with 3 iterations and query XML action with single xpath expression within it.

Reply
akalmar
Nintex Newbie

Re: Why would a workflow skip over a loop?

I just tried using "less than or equal to" and the workflow still skipped over the loop section.  I tried just "less than", as well, but with the same results.  I also filled out a fresh new form and then ran the updated workflow.  Still, the loop was skipped.  I am at a loss!

0 Kudos
Reply
akalmar
Nintex Newbie

Re: Why would a workflow skip over a loop?

How would I be able to extract data from a repeating section without a loop?  Each row has 5 fields and a user can add multiple rows.  If you could show me how to do this type of extraction of data without a loop, I'd really appreciate it!

0 Kudos
Reply
akalmar
Nintex Newbie

Re: Why would a workflow skip over a loop?

I finally got it working!  As it turns out, the loop won't start unless a "return type" is chosen.  And of course, the "is less than or equal to" selection allowed all 3 entries in the repeating section to be captured. 

Thanks to the two people who replied!

Reply
Automation Master
Automation Master

Re: Why would a workflow skip over a loop?

it's quite simple

let's have repeater XML like this

<?xml version="1.0" encoding="utf-8"?>
<RepeaterData>
     <Version />
     <Items>
          <Item>
               <ID type="System.String">1</ID>
               <name type="System.String">john</name>
               <country type="System.String">US</country>
          </Item>
          <Item>
               <ID type="System.String">2</ID>
               <name type="System.String">jane</name>
               <country type="System.String">MX</country>
          </Item>
          <Item>
               <ID type="System.String">3</ID>
               <name type="System.String">jerry</name>
               <country type="System.String">BR</country>
          </Item>
     </Items>
</RepeaterData>

then you can configure Query XML action like this

I defined 3 outputs for 3 RS fields (ID, name country)

output will then look like this

so you get 3 datasets (one per each column) with as many rows as you have in RS.

important is that since you get dataset you have to store result into collection variables and not scalar ones!

Reply
akalmar
Nintex Newbie

Re: Why would a workflow skip over a loop?

Thank you!  I'll try that!

0 Kudos
Reply
Nintex Employee
Nintex Employee

Re: Why would a workflow skip over a loop?

Hello ‌ - 

Glad to see that you got it working! Be sure to mark your question as answered so that others can find out what you did quickly!

If you have more questions regarding the repeating section and extracting your data, I would suggest starting a new question so that you can surface those answers there a bit easier!

Reply