XML Parser Template Help Needed

Hello!  I am new at this and would appreciate help!  I have a listener getting transaction fields from NetSuite that I need to send as an xml file to an ftp site.  I keep getting the error "no footer found in the template".  Here is my XML Parser Template:

<?xml version="1.0" encoding="utf-8"?>
  {{#each data}}
  <wmsorder> 
    <header> 
      <emailonerror>customerservice@x</emailonerror> 
      <emailonaccepted> customerservice@x </emailonaccepted> 
      <emailnotifications>customerservice@x</emailnotifications> 
      <refnr>{{refnr}}</refnr> 
      <ponr>{{ponr}}</ponr> 
      <relation>10339</relation> 
      <requiredby></requiredby> 
      <servicelevel>BSN</servicelevel> 
      <note></note> 
   </header>
   <location> 
      <name>{{name}}</name> 
      <street>{{street}}</street> 
      <street2>{{street2}}</street2> 
      <nr>1234</nr> 
      <zip>{{zip}}</zip> 
      <city>{{city}}</city> 
      <country>{{country}}</country> 
      <phone>{{phone}}</phone> 
      <contact> 
        <name>Receiving</name> 
       <phone>0031885552244</phone> 
       <email></email>
      </contact> 
    </location> 
    <orderlines>
      {{#each orderline}}
      <orderline> 
        <type>EXPORT</type> 
       <outboundwhs>MS2</outboundwhs> 
       <qty>{{qty}}</qty> 
       <partnr>{{partnr}}</partnr> 
       <refnr>{{Lrefnr}}</refnr>
      </orderline>{{/each}}
   </orderlines>
 </wmsorder>{{/each}}

Can anyone help me resolve this error?

0

Comments

14 comments
Date Votes
  • I should have said that I have tried adding <footer></footer> into the file just below the header and also after </orderlines>.  This does not resolve the error.

    0
  • Beverly Bishop can you provide a JSON sample output so I can play around with this in my environment?

    0
  • Tyler Lamparter  Here is a screenshot of my window.  Let me know what you need:

    0
  • Tyler Lamparter

    {
      "data": [
        {
          "qty": "quantity",
          "partnr": "item.name",
          "Lrefnr": 999,
          "refnr": "tranid",
          "name": "entity.name",
          "street": "shippingaddress.addr1",
          "street2": "shippingaddress.addr2",
          "zip": "shippingaddress.zip",
          "city": "shippingaddress.city",
          "country": "shippingaddress.country.internalid",
          "phone": "(917)494-4476",
          "ponr": "otherrefnum"
        }
      ],
      "importName": "Klairy Testing",
      "connectionName": "FTP Connection",
      "uuid": "x",
      "settings": {
        "integration": {},
        "flow": {},
        "flowGrouping": {},
        "connection": {},
        "import": {}
      }
    }

    0
  • Beverly Bishop where does the error happen? When you try to save it or when you try to run it? Or when your provider picks up the generated xml?

    0
  • Tyler Lamparter   When I run the flow.

    0
  • Beverly Bishop the issue is due to the {{#each}} being used for a xml tag that has to be underneath a tag that can handle multiple orders. For example, we usually see a plural tag where multiple orders can live underneath it. See below screenshot. Without that, we would be creating invalid xml if there were multiple orders because we can't have a singular tag not underneath a header and footer tag.

    <?xml version="1.0" encoding="utf-8"?>
    <wmsorders>
      {{#each data}}
      <wmsorder> 
        <header> 
          <emailonerror>customerservice@x</emailonerror> 
          <emailonaccepted> customerservice@x </emailonaccepted> 
          <emailnotifications>customerservice@x</emailnotifications> 
          <refnr>{{refnr}}</refnr> 
          <ponr>{{ponr}}</ponr> 
          <relation>10339</relation> 
          <requiredby></requiredby> 
          <servicelevel>BSN</servicelevel> 
          <note></note> 
       </header>
       <location> 
          <name>{{name}}</name> 
          <street>{{street}}</street> 
          <street2>{{street2}}</street2> 
          <nr>1234</nr> 
          <zip>{{zip}}</zip> 
          <city>{{city}}</city> 
          <country>{{country}}</country> 
          <phone>{{phone}}</phone> 
          <contact> 
            <name>Receiving</name> 
           <phone>0031885552244</phone> 
           <email></email>
          </contact> 
        </location> 
        <orderlines>
          {{#each orderline}}
          <orderline> 
            <type>EXPORT</type> 
           <outboundwhs>MS2</outboundwhs> 
           <qty>{{qty}}</qty> 
           <partnr>{{partnr}}</partnr> 
           <refnr>{{Lrefnr}}</refnr>
          </orderline>{{/each}}
       </orderlines>
     </wmsorder>{{/each}}
    </wmsorders>

     

    However, if you need to only send 1 transaction per file, then you could modify your setup to look like this:

    <?xml version="1.0" encoding="utf-8"?>
    <wmsorder> 
      <header> 
        <emailonerror>customerservice@x</emailonerror> 
        <emailonaccepted> customerservice@x </emailonaccepted> 
        <emailnotifications>customerservice@x</emailnotifications> 
        <refnr>{{data.0.refnr}}</refnr> 
        <ponr>{{data.0.ponr}}</ponr> 
        <relation>10339</relation> 
        <requiredby></requiredby> 
        <servicelevel>BSN</servicelevel> 
        <note></note> 
     </header>
     <location> 
        <name>{{data.0.name}}</name> 
        <street>{{data.0.street}}</street> 
        <street2>{{data.0.street2}}</street2> 
        <nr>1234</nr> 
        <zip>{{data.0.zip}}</zip> 
        <city>{{data.0.city}}</city> 
        <country>{{data.0.country}}</country> 
        <phone>{{data.0.phone}}</phone> 
        <contact> 
          <name>Receiving</name> 
         <phone>0031885552244</phone> 
         <email></email>
        </contact> 
      </location> 
      <orderlines>
        {{#each data}}
        {{#each orderline}}
        <orderline> 
          <type>EXPORT</type> 
         <outboundwhs>MS2</outboundwhs> 
         <qty>{{qty}}</qty> 
         <partnr>{{partnr}}</partnr> 
         <refnr>{{Lrefnr}}</refnr>
        </orderline>{{/each}}{{/each}}
     </orderlines>
    </wmsorder>

    You also would need to enable "skip aggregation" on the import step.

     

    0
  • Thank you so much for helping a newbie!!  Any chance you can point me to an article to learn about the data.0.x tags?

    0
  • Beverly Bishop we have this (https://docs.celigo.com/hc/en-us/articles/360038857412-Literal-segments-and-handlebars-identifiers) which may help some. In general, if you have an array of data, you need to either loop through the array and perform some action or you need to specify what object index within the array you would like to pull out. In this example, you are given an array of data and there will only ever be 1 object in the data array because you enabled "skip aggregation". Since there will only ever be 1 object in there, you need to specify the path to the first object, which is 0. 0 index is always the first index when working with json. Hopefully that helps

    0
  • Thanks again.

    0
  • Hi again, Tyler Lamparter,

    I'm afraid that I still don't have this working and can't figure out what I'm doing wrong.  With this:

    <?xml version="1.0" encoding="utf-8"?>
    <wmsorder> 
       <header> 
         <emailonerror>customerservice@x</emailonerror> 
         <emailonaccepted> customerservice@x</emailonaccepted> 
         <emailnotifications>customerservice@x</emailnotifications> 
         <refnr>{{data.0.refnr}}</refnr> 
         <ponr>{{data.0.ponr}}</ponr> 
         <relation>10339</relation> 
         <requiredby></requiredby> 
         <servicelevel>{{data.0.servicelevel}}</servicelevel> 
         <note></note> 
       </header>
       <location> 
         <name>{{data.0.name}}</name> 
         <street>{{data.0.street}}</street> 
         <street2>{{data.0.street2}}</street2> 
         <nr>{{data.0.street}}</nr> 
         <zip>{{data.0.zip}}</zip> 
         <city>{{data.0.city}}</city> 
         <country>{{data.0.country}}</country> 
         <phone>{{data.0.phone}}</phone> 
         <contact> 
           <name>{{data.0.AttnName}}</name> 
           <phone>{{data.0.CPhone}}</phone> 
           <email></email>
         </contact> 
       </location>
       <orderlines>
        {{#each data}}
        <orderline> 
          <refnr>{{Lrefnr}}</refnr>
         <type>EXPORT</type> 
         <outboundwhs>Relievant MS2</outboundwhs> 
         <qty>{{qty}}</qty> 
         <partnr>{{partnr}}</partnr>
         <refnr>{{Lrefnr}}</refnr>
        </orderline>{{/each}}
       </orderlines>
    </wmsorder>

    I get these results:

    <?xml version="1.0" encoding="utf-8"?>
    <wmsorder> 
       <header> 
         <emailonerror>customerservice@x</emailonerror> 
         <emailonaccepted> customerservice@x</emailonaccepted> 
         <emailnotifications>customerservice@x</emailnotifications> 
         <refnr>SO7287</refnr> 
         <ponr>Test1</ponr> 
         <relation>10339</relation> 
         <requiredby></requiredby> 
         <servicelevel></servicelevel> 
         <note></note> 
       </header>
       <location> 
         <name></name> 
         <street></street> 
         <street2></street2> 
         <nr></nr> 
         <zip>35022-4527</zip> 
         <city></city> 
         <country>US</country> 
         <phone></phone> 
         <contact> 
           <name></name> 
           <phone></phone> 
           <email></email>
         </contact> 
       </location>
       <orderlines>
        <orderline> 
          <refnr></refnr>
         <type>EXPORT</type> 
         <outboundwhs>Relievant MS2</outboundwhs> 
         <qty>3,2,1</qty> 
         <partnr>FG 0046 Additional Level Access Instruments,FG 0060 Access Instruments,FG 0043 RF Probe</partnr>
         <refnr></refnr>
        </orderline>
       </orderlines>
    </wmsorder>

    If I add the {{each orderline}} and {{/each}} exactly as you have it in your example, I don't get any orderline data.  I can't figure out how to get the data to repeat all of the order lines.

    ...

       </location>
       <orderlines>

       </orderlines>
    </wmsorder>

    Also, I can only get the Ship Country and Ship Zip to come through from NetSuite.  What am I doing wrong?

    Appreciate your help so much!

    0
  • Beverly Bishop can you join office hours tomorrow? Someone may be able to help you there since it seems like you have multiple setup issues here. Here is the sign up link: https://zoom.us/meeting/register/338c30f6ce7573eacde7dc3c8da9331e#/registration.

    What does your input data look like now? The sample you provided before didn't include any order line data. Why do you have a transform step on your initial NetSuite source step? Can you screenshot that? That could potentially be setup incorrectly as well which may be leading to issues here.

    0
  • I have signed up for office hours today.  Thanks. 

    Here are screenshots of my current process.  I removed the transform step. I'm not currently using the lookup, but I will need to to get just the item numbers to flow through without the descriptions.

    0
  • Beverly Bishop were you able to get help in office hours?

    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post