{"id":5535,"date":"2017-11-16T16:47:08","date_gmt":"2017-11-16T16:47:08","guid":{"rendered":"https:\/\/alt2.minisoft.com\/support\/?p=5535"},"modified":"2020-07-01T12:59:19","modified_gmt":"2020-07-01T19:59:19","slug":"eformz-txt-to-xml-guide-state-loops","status":"publish","type":"post","link":"https:\/\/www.minisoft.com\/support\/eformz-txt-to-xml-guide-state-loops\/","title":{"rendered":"eFORMz TXT To XML Guide: State Loops"},"content":{"rendered":"<p>Part One:\u00a0<a href=\"\/support\/index.php\/eformz-txt-to-xml-guide-getting-started\/\">eFORMz TXT to XML Guide: Getting Started<\/a><br \/>\nPart Two:\u00a0<a href=\"\/support\/index.php\/eformz-txt-to-xml-guide-reset-line-number-count\/\">eFORMz TXT to XML Guide: Reset Line Number Count<\/a><br \/>\nPart Three:\u00a0<a href=\"\/support\/index.php\/eformz-txt-to-xml-guide-states\/\">eFORMz TXT To XML Guide: States<\/a><\/p>\n<p>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.<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree1.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-5536\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree1.jpg\" alt=\"\" width=\"810\" height=\"330\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree1.jpg 777w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree1-300x122.jpg 300w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree1-768x313.jpg 768w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree1-150x61.jpg 150w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree1-250x102.jpg 250w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree1-550x224.jpg 550w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree1-441x180.jpg 441w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree1-735x300.jpg 735w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><\/a><br \/>\nStart 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.<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree2.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-5537\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree2.jpg\" alt=\"\" width=\"465\" height=\"67\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree2.jpg 387w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree2-300x43.jpg 300w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree2-150x22.jpg 150w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree2-250x36.jpg 250w\" sizes=\"(max-width: 465px) 100vw, 465px\" \/><\/a><br \/>\nCreate another line for your piece of information that you want to extract out. I named mine &#8220;DLXItemNumber&#8221; Notice how there are two pieces of data that I want to retire, &#8220;DLX Number&#8221; and &#8220;OrderLineNumber&#8221;. Also both &#8220;DLX Numbers&#8221; are highlighted 500 and 504.<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree4.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-5539\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree4.jpg\" alt=\"\" width=\"265\" height=\"268\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree4.jpg 265w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree4-148x150.jpg 148w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree4-75x75.jpg 75w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree4-48x48.jpg 48w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree4-250x253.jpg 250w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree4-178x180.jpg 178w\" sizes=\"(max-width: 265px) 100vw, 265px\" \/><\/a><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree3.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-5538\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree3.jpg\" alt=\"\" width=\"955\" height=\"148\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree3.jpg 904w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree3-300x46.jpg 300w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree3-768x119.jpg 768w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree3-150x23.jpg 150w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree3-250x39.jpg 250w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree3-550x85.jpg 550w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree3-800x124.jpg 800w\" sizes=\"(max-width: 955px) 100vw, 955px\" \/><\/a><br \/>\nTo be able to extract the information from two places in one line you simply add a second parameter.<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree5.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-5540\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree5.jpg\" alt=\"\" width=\"216\" height=\"66\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree5.jpg 193w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree5-150x46.jpg 150w\" sizes=\"(max-width: 216px) 100vw, 216px\" \/><\/a><br \/>\nAfter filling in the column&#8217;s and length&#8217;s information you will see that it will grab both of the line&#8217;s information.<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree7.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-5542\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree7.jpg\" alt=\"\" width=\"217\" height=\"113\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree7.jpg 197w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree7-150x78.jpg 150w\" sizes=\"(max-width: 217px) 100vw, 217px\" \/><\/a><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree6.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-5541\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree6.jpg\" alt=\"\" width=\"661\" height=\"106\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree6.jpg 636w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree6-300x48.jpg 300w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree6-150x24.jpg 150w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree6-250x40.jpg 250w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree6-550x88.jpg 550w\" sizes=\"(max-width: 661px) 100vw, 661px\" \/><\/a><br \/>\nCreate the following line variables for the rest of the information you want.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-5543\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree8.jpg\" alt=\"\" width=\"243\" height=\"81\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree8.jpg 193w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree8-150x51.jpg 150w\" sizes=\"(max-width: 243px) 100vw, 243px\" \/><br \/>\nNext we will place these into a state starting with the &#8220;ItemDetailsState&#8221; line. I have my structure setup where the variables will be in the following folder location\u2026 ex \\Items\\ItemDetails\\DLXItemNumber<\/p>\n<p>Notice the following conditions:<\/p>\n<ol style=\"margin-left: .375in; direction: ltr; unicode-bidi: embed; margin-top: 0in; margin-bottom: 0in;\" type=\"1\">\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\" value=\"1\">The end state of &#8220;OrderDetail&#8221; state <strong>MUST<\/strong> be the start state of your next state, otherwise it will not work. In this case you can see &#8220;ItemDetailsStart&#8221; is the end state of &#8220;OrderDetail&#8221;, but the start state of &#8220;ItemDetailsStart&#8221;.<\/li>\n<li style=\"margin-top: 0; margin-bottom: 0; vertical-align: middle;\">The end state &#8220;DLXItemNumber&#8221; is also the start state for &#8220;ItemDetails&#8221;. This is what creates the loop.<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-5544\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree9.jpg\" alt=\"\" width=\"316\" height=\"271\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree9.jpg 262w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree9-150x129.jpg 150w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree9-250x215.jpg 250w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree9-210x180.jpg 210w\" sizes=\"(max-width: 316px) 100vw, 316px\" \/><br \/>\nHere is the finished result! It created two separate folders for the different items in XML. It looped by getting each item&#8217;s detail and when it saw &#8220;DLXItemNumber&#8221; it restarted the loop.<\/p>\n<p><a href=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree10.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-5545\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree10.jpg\" alt=\"\" width=\"401\" height=\"234\" srcset=\"https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree10.jpg 342w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree10-300x175.jpg 300w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree10-150x88.jpg 150w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree10-250x146.jpg 250w, https:\/\/www.minisoft.com\/support\/wp-content\/uploads\/2017\/11\/XMLGuidePartThree10-308x180.jpg 308w\" sizes=\"(max-width: 401px) 100vw, 401px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Part One:\u00a0eFORMz TXT to XML Guide: Getting Started Part Two:\u00a0eFORMz TXT to XML Guide: Reset Line Number Count Part Three:\u00a0eFORMz 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 [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58],"tags":[244,275,274,277,279,280,281,276,278,273,6,282,265,132],"_links":{"self":[{"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/5535"}],"collection":[{"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/comments?post=5535"}],"version-history":[{"count":3,"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/5535\/revisions"}],"predecessor-version":[{"id":8166,"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/5535\/revisions\/8166"}],"wp:attachment":[{"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/media?parent=5535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/categories?post=5535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.minisoft.com\/support\/wp-json\/wp\/v2\/tags?post=5535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}