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

Auto Increment within a loop function

I found a few things on line, but none of it quite got me there.

List A is "Intake".  The fields are "Starting Check Number" and "Ending Check Number".  There is a calculated field called Number of Checks (Ending-Starting)+1 to calculate the number of checks in the range.  Nintex workflow on "Intake" is a loop (Loop N Times) that uses the "Number of Checks" field as "N".  Create a List Item action creates an item "N" times on List B.  I've built a few variables, and a math function to add +1, but therein lies the problem I think...

List B is "Output".  Currently the only field on List B (other than title, which autofills) is "Check Number".

Currently what works: A line item is created "N" times in List B. 

What isn't working: My variables aren't incrementing.  What I'm getting is the "Starting Check Number" N-times.  What I need is the first item to be the Starting Check Number, and each "N" after that to add +1.

I'm right there!  I can actually see where my variable/looping logic is flawed... I just can't figure out how to work around it.  Any help would be appreciated.

0 Kudos
Reply
4 Replies
Community Manager Community Manager
Community Manager

Re: Auto Increment within a loop function

@mikeatnationwid 

Mike, I'm hoping you got this working by now and would love to know what you did to solve it. A screenshot would be cool. If you didn't lets see what we can do to get this done for you. 

0 Kudos
Reply
mikeatnationwid
Nintex Newbie

Re: Auto Increment within a loop function

My first chance to give really something back to the community... very cool.

After a lot of monkeying around I found that my main problem was that I had the order of my action items wrong and I had my initial "Set Workflow Variable" action items inside the loop.  I tend to be the 'workaround guy', so I'm sure there are better ways to do this, but it works, I'm happy, the customer is happy, so there you go.

 

This is the entire workflow:wf01.png

 

My next two actions are setting two different variables.  (Yeah, I know, I can do that in one step - but these are the two I had out of order and inside the loop, and I just left them alone once I got the workflow to run.)

 

The first is storing the starting check number from the list, the second is creating a variable for the count but then saving it right back onto the the previous variable.  I'm not sure why this works, because it sounds redundant... but it works.

wf02.png

 

wf03.png

 

 

Loop N Times - just pulls a number from my list that I calculate in the form and feed back to the list.  That number is the difference between the starting and ending check number range.

wf04.png

 

 

The next two are for building a string and really aren't important to the original issue.  Basically, I needed to turn the check numbers into text to allow for padding of a number of zeros to the beginning of each check number until the number of digits equaled 8.wf05.png

 

wf06.png

 

 

Now to create the list item.  I'm not showing the entire action item here, but you can see where it is creating the check number based on the varCount variable from earlier.wf07.png

 

New Workflow Variable - creating a variable to store the modification of +1 for the incrementation.

 

wf08.png

 

And lastly, a calculation to add my two variables together and output the sum back to the varCount variable.  The new varCount is added in the create list item function each time the loop loops.

wf09.png

 

 

I hope this helps you and others out.  It was a stinker to figure out, but was amazingly gratifying once it fell into place.  Since then I've created two other looping workflows.

 

0 Kudos
Reply
mikeatnationwid
Nintex Newbie

Re: Auto Increment within a loop function

I responded to your question with a pretty lengthy post along with screenshots. The Community tagged it as spam and I'm guessing sent it over to the moderators. I'm hoping once they see it isn't spam they will add it back. If not, I will try to respond again with shorter sections.
0 Kudos
Reply
mikeatnationwid
Nintex Newbie

Re: Auto Increment within a loop function

It doesn't look like the mods have released the original post, so let's try this.  I'm attaching a Word document.  Let me know if this works for you.  If it does, could you click the "Accept as Solution" button in the post?

 

Mike

 

 

0 Kudos
Reply