skipEntry or exitBranch?

For many years, TDI users have been calling system.skipEntry() to skip over the current work object and get on to the next one. In most cases it has the desired effect of terminating the current AL cycle and starting the next. However, the actual definition of skipEntry is to skip the remaining components in this AL and retrieve the next Entry from the currently active Iterator -- and this might not be what you had in mind.

For example, if the AL uses a Server mode Connector, then calling system.skipEntry() will stop the cycle without allowing the Connector to send a reply back to the connected client.

Another case is when an AssemblyLine is called in manual mode (e.g. with the AssemblyLine Function component, or script). The AL FC lets you easily re-use an AssemblyLine as a single component in another AL. By setting the FC to manual (or cycle mode) you effectively replace the Feeds section of the called AL with the Output Map of the FC, since the Feeds section of this sub-AL is ignored. Each time the FC is executed, data is passed to the called AL via the FC's Output Map, and this populates the Work Entry that is passed to sub-AL's Flow section. If system.skipEntry() is called during this single-cycle operation of the called AssemblyLine, an error will occur since there is no Iterator to return the next Entry.

The solution is to use system.exitFlow() which has the effect of skipping the rest of the Flow section in the current AL. As such, the Server mode Connector gets to make its reply, and no errors result due to the absence of an Iterator.

The system.exitBranch() method is used to exit Loops and Branches, and the Flow section of an AL is just a Loop that is based on the Connectors in the Feeds section.

Where you want to break from the body of a loop and start at the top again, system.continueLoop(<loopname>) is the way to go.

NOTE For AssemblyLines with Server mode Connectors you must use task.shutdown() instead. Calling exitFlow() or skipEntry() will not correctly free up the Flow section to the AL Pool.

-- AndrewFindlay - 01 Nov 2005

-- EddieHartman - 26 Apr 2011
Topic revision: r7 - 17 Dec 2014, AndrewFindlay - This page was cached on 04 Aug 2023 - 15:42.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TDI Users? Send feedback