eFORMz TXT To XML Guide: States
In Part 2 we set up a “State” inside of a “State” to reset the line number count. This post looks more at the “State” variables.
The structure of our states was set-up as the following:
|Level||State||EndState||XML Variable Tag|
Notice how there are levels to each State. If you want to go down a level you must create a nested folder. Ex. eFORMz defaults the “Null” state to be set at level 0. So when we created the state “OrderDetail” inside of the state “Null” it was at level 1. Since the OrderDetail state we created was a has a value in the “Tag” row, which means it is creating a XML Folder Tag, it then creates a new level for any variables that are put inside of it. This would mean CustomerNumber is level 2 and inside of OrderDetail, which is at level 1.
Another way to think about this is how the file system is setup on Windows. There can be folders, with folders inside of them, and information inside of those folders. Each folder that is inside of a folder is a deeper level.
We have talked about the levels of the states, the states themselves, but we haven’t talked about the endstates. The endstates determine when the state is going to end. For example, our state OrderDetail has the endstate “EndOfFile”. If you wanted to extract a line that was after the “EndOfFile” endstate you would not be able to grab that line in the “OrderDetail” state. Below is an example:
Here I am moving my endstate’s line, “EndOfFile”, to line 2.
If I wanted to grab a line after the endstate’s line in the same state that has the endstate it will not work.
I have a created a new variable that is after my “EndOfFile” “EndState”. EndOfFile is at line 2 and “LineWeWant…” is at line 3. Don’t forget that since these states are inside of the “OrderDetail” state that the line number count resets, so you should set your line number to be set at “2” because it is two down from the “OrderDetail” state, whom’s line is at 0. When you click on your line variable it will NOT correctly update the line that it is currently on. Here it looks like it is on line 2, which is highlighted, but it is on line 3.
Here is the state view with our state’s “LineWeWantAfterEndState” line.
Notice when you select “Set” and “Test” that variable will not come up. There are two reasons for this. Number one being that each state will need a “EndState”. CustomerNumber and LineWeWantAfterEndState does not have a “EndState”. Number two is that the “EndOfFile” state is a line above “LineWeWantAfterEndState”. Let’s fix that.
I have created a new line for our new “EndState”. It is after the text that we want to extract.
We then place in our “EndState”s to each state. We can leave them empty and they will default to the “OrderDetail”’s “EndState”, which is our new “EndState”, “NewEndOfStateLine”.
Select “Set” and select “Test” and you will see your new variable.