eFORMz TXT To XML Guide: State Loops
We are going to talk about how states can loop on lines to create a consistent format. Take a look at the following example. We have two order items, a cake pan and a brownie pan.
Create another line for your piece of information that you want to extract out. I named mine “DLXItemNumber” Notice how there are two pieces of data that I want to retire, “DLX Number” and “OrderLineNumber”. Also both “DLX Numbers” are highlighted 500 and 504.
Next we will place these into a state starting with the “ItemDetailsState” line. I have my structure setup where the variables will be in the following folder location… ex \Items\ItemDetails\DLXItemNumber
Notice the following conditions:
- The end state of “OrderDetail” state MUST be the start state of your next state, otherwise it will not work. In this case you can see “ItemDetailsStart” is the end state of “OrderDetail”, but the start state of “ItemDetailsStart”.
- The end state “DLXItemNumber” is also the start state for “ItemDetails”. This is what creates the loop.
Here is the finished result! It created two separate folders for the different items in XML. It looped by getting each item’s detail and when it saw “DLXItemNumber” it restarted the loop.