Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-02-2011, 01:03 PM
joe12 joe12 is online now
Registered User
 
Join Date: 05-26-2011
Posts: 8
Loop Action - Nested Loops

It says in the Help: A Loop action cannot be nested within another Loop action.

I have a Loop Action that iterates over an ADO record set and calls a subroutine within the loop block. In that subroutine I have another Loop Action which also loops over another ADO record set.
Nesting seems to work ok using the subroutine mechanism of nested loops.


Why does it work using the subroutine but the help says nesting is not allowed?

What is the best way to handle nesting of loop actions and why are there restrictions on nesting of loops?
Reply With Quote
  #2  
Old 06-02-2011, 03:08 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
I'm surprised that works, and I don't think it does for most types of loops. The limitation has to do with how looping is handled internally, and removing the limitation is on the todo list.

Other options for now are for one of the loops, to store the results in a macro and use a repeating build rule to iterate.
http://www.kinook.com/VisBuildPro/Ma...scriptloop.htm

Or put the inner loop in another .bld file and call it with the VisBuildPro Project action.
http://www.kinook.com/VisBuildPro/Ma...projaction.htm
Reply With Quote
  #3  
Old 06-02-2011, 06:59 PM
joe12 joe12 is online now
Registered User
 
Join Date: 05-26-2011
Posts: 8
So I changed out the Loop Action steps to just loop over a Run Script action where I use the vbld_AddDelimValue or vbld_PushDelimValue call to capture all the values I will need to loop over.

Then I use a Group step to do the looping, by using the "Repeat step..." checkbox and place my temporary macro as the condition that must be "is defined". Inside the Group step I use another Run Script action and use vbld_PopDelimValue to get one of the items to be looped over.

Doing it this way, the Loop Action step is never nested inside another Loop Action, but it does get nested inside a "repeating mode" Group step.

Note that these "repeating mode" Group steps are now being used as loops, and are nested.


I tried that and it does seem to work, is that the best way to do this?

Also, I think my implementation might not be as clean as it could be. Is the nesting of Group steps which are set to "Repeat..." with the use of the vbld_PushDelimValue and vbld_PopDelimValue calls shown in any of the example projects?

Last edited by joe12; 06-02-2011 at 07:16 PM.
Reply With Quote
  #4  
Old 06-03-2011, 11:27 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
That sounds about right. I have attached a sample that demonstrates this.
Attached Files
File Type: bld NestedLoops.bld (1.9 KB, 1517 views)
Reply With Quote
  #5  
Old 02-24-2012, 09:25 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
This is supported in v8.0.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 11:59 AM.


Copyright © 1999-2023 Kinook Software, Inc.