Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: ejonesThanks, that example was fun to put together.
As far as examples and documentation. From the node editor you can click on node help. And there are examples of the looping node that are installed with LAE. Look in your Documents -> Public Documents -> Lavastorm BRAIN -> Examples folder. The graph is named IterationExample. The most interesting examples in that graph are the "File Producer" and "File Consumer" combination of nodes.
I've been working more with looping over the last couple of days. Here are the things I've learned.
- It is fair to think of the nodes involved with the loop as a sub-graph. There is no connection that can be made between those nodes and the rest of the nodes in the graph if you want it to work.
- There is one, and only one, input to the loop which is the top input of the "Do While" node. There can be inputs to other nodes that are inside the loop, but they must be able to be available before the nodes in the loop need them and they will be the same value for each iteration.
- There is one, and only one, output of the loop which is the top output of the "Do While" node.
- The output from the bottom output of the "Do While" node comes from either the loop input data, or the bottom input. Both of those inputs should have the same structure.
- The bottom input to the "Do While" contains what goes into the output of the loop. You can choose whether the output is an accumulation of everything or just the last set of data sent.
- You can end the looping by sending zero records into the bottom input of the "Do While" but if you do that, and if you have not accumulated your output, you have zero records on the output.
- If you really need an additional output of the loop, you'll have to write it using an "Output BRD File" node perhaps making it append multiple sets records to the one file. Then after the loop a "BRD File" node can read it.
- If accumulating the output and you want to restart, you might have to drill inside the node, find the file that has been accumulating data and delete it. In this example on the first post above I added a feature that gives you another way to do it.
Maybe all these things I've learned and written are correct, and if not, I hope someone corrects me on them. I'd like to see other people post what they've learned. I expect to come back and read this page when I need looping again to help refresh my memory as to how it works.
Attachments:
LoopExampleGraph.jpg