Latest News

the latest news from our team

eFORMz TXT To XML Guide: State Loops

Part One: eFORMz TXT to XML Guide: Getting Started
Part Two: eFORMz TXT to XML Guide: Reset Line Number Count
Part Three: eFORMz TXT To XML Guide: States

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.

Start by creating a new line that is above the information you want to extract. Mine selects the line that Footer Message: is on, which is above the information we want.

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.

To be able to extract the information from two places in one line you simply add a second parameter.

After filling in the column’s and length’s information you will see that it will grab both of the line’s information.

Create the following line variables for the rest of the information you want.

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:

  1. 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”.
  2. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *