Online Help TEDILoopStack
Unit JclEDI
Types
TEDILoopStack |
||||||||||||||||||||
The TEDILoopStack object is designed to keep track of the implicit nesting of segments and assist in building an object hierarchy as an EDI document object formats a TEDITransactionSet or TEDIMessage type object.
The TEDILoopStack is designed to contain an array of records of type TEDILoopStackRecord.
The TEDILoopStackArray is what is treated as a stack. When TEDILoopStack is used, items (records) will be pushed and popped from the stack (array).
EDI document type objects use the TEDILoopStack while looping (in code) through a table (array) of data and a table (array) of specifications at the same time. While going through each loop, the EDI document class calls the TEDILoopStack.ValidateLoopStack function. Based on the input data, this function handles most of the management of the TEDILoopStackArray thus pushing, popping, and updating the stack as needed. The ValidateLoopStack function must be called once prior to the EDI document looping in order to initialize the stack and set the base container object.
In order for an EDI document type object to build an object hierarchy from the EDI data and specification file, a TEDILoopStackOnAddLoopEvent event handler should be assigned to the TEDILoopStack.OnAddLoop property. The TEDILoopStack object not only keeps track of the nesting of segments and loops but also knows when to create a new EDI-Loop type object. The event handler will be responsible for creating new EDI-Loop objects, assigning any loop values such as Id, and returning the new loop object through the var EDIObject parameter. After the event is handled the EDIObject will be added or updated to the stack thus becoming the current EDI-Loop object (or container) for other objects during the EDI document looping (in code) process.
There are a few internal flags in this class that are important to know.
Other miscellaneous notes:
When entries are popped from the stack EDI-Loop objects are
not freed. This is correct because the EDI document object (object hierarchy)
that is being built must manage the objects, the stack is not supposed to manage
the objects. |
Usage
Notes & Examples |
See the following for implementation examples: JclEDI_ANSIX12.TEDITransactionSetDocument JclEDI_ANSIX12_Ext.TEDI_ANSIX12_Document JclEDI_UNEDIFACT_Ext.TEDI_UNEDIFACT_Document |