Loop action used as a delay


Badge +5

Hello everyone, does anyone have a sample NW2010 wf that uses a loop action to create a 2-3 minute delay?

I dont want to use the 'Pause For' as it waits a minimum of 5 minutes.

thanks

Steve


10 replies

Badge +3

You can use 'Pause For' instead of 'Pause Until', then configure the Pause For action and change the number of minutes to whatever you want.

Badge +5

Thank you for the reply Cheryl, I should have put 'Pause For' in my original post, sorry for the confusion on my part. The Pause For runs on the SharePoint timer job which has a default time of 5 minutes. So if you put 1 minute in it will still take up to 5 minutes.

regards

Steve

Userlevel 3
Badge +9

Does the 'Pause Until' also run based on the SharePoint timer job?  For example, if you used a calculate date action and calculated a date/time that was 2 minutes in the future, and then used the 'Pause Until' based on that date, would it still wait the 5 minutes?

Badge +6

all of the above assumptions are correct. All actions using some kind of delay are based on the timer job. You could get around the "issue" by changing the timer job interval or, when you use a loop, by turning off safe looping. Having said that, unless it is really, really (!!) necessary, I would not recommend any option as they have quite an impact on the server performance.

Badge +5

Thank you Patrick, I agree with your not turning off safe looping.

regards

Steve

Badge +5

Brendan, i accidently erased your other message about the for each. I apologize for that.

I did try it by creating a collection variable, setting it to 5000 and then running the for each on it.

works great, so if i hadnt accidently deleted your post i would of also marked yours as the answer,

Thank you!

Userlevel 3
Badge +9

Well I'll do my best to remember what I said.  So looping won't work because it also has a delay built into it.  However the For Each action does not.  So you can create a dummy collection and have the For Each run through that to create a time delay.  It runs through the collection pretty quickly though.  So in my own testing I had to create a collection of 5000 items to get it to take approx 3 minutes. 

Badge +5

i was too fast in my reply about it working. I apparently only put in one item with a value of 5000 into the collection.

Where did you get the 5000 items? a sp list? or did you use logic to cycle the collection operation using an 'add' 5000 times?

Then you run the for each against that collection to create the delay or timer so to speak.

Sorry if i seem dense about this, i am somewhat new to nintex.

Userlevel 3
Badge +9

Yes, you have to construct a collection.  You'll need 1 number variable, 2 text variables, and a collection variable.  In the screen shots below I have the follwoing variables:

n_DelayCount (number)

PaddedLeftStringWithDelimeter (single line of text)

PaddedLeftString (single line of text)

TempPaddedLeftStringCollection (collection)

The n_DelayCount variable I set the default value in the variable settings to 5000.  You can change this to suit your needs.

Use a Build String with a fn-PadLeft inline function as shown below.  The will update the "PaddedLeftStringWithDelimeter" with the number of hyphens based on the number in the n_DelayCount.

For_Each_Delay_1.png

Next use a Regular expression to replace the hypen with a zero followed by a semi-colon.

For_Each_Delay_2.png

Finally use one more Regular expression to split up the text.  This will create a proper collection variable, with the number of items specified in the n_DelayCount variable.

For_Each_Delay_3.png

Now you can use this collection in your For Each. 

Badge +5

Thank you very much Brendan, I will give this a try. this is new ground for me and i really appreciate your help.

thanks again

Steve

Reply