xml tag is not generate if value is the same in xml.

24 views
Skip to first unread message

Borgee

unread,
Jul 1, 2022, 7:37:16 AM7/1/22
to Bots Open Source EDI Translator
  hi all, need some help in this weird behavior i noticed when i try to loop the output with the same value in the output. 

output is suppress if the value is the same value in xml. 
I want to output P0401 to  cbc:PackQuantity  and P0414  to PackSizeNumeric

INPUT LOOKS LIKE THIS:

PO1*0000001129*90576*EA*2.82*PE*SK*1998788*ST*GB8FDC*UP*032251802706
CTP**RTL*7
PID*F****Cat Orange
PO4*144*************8
PO1*0000001444*24048*EA*1.58*PE*SK*1998802*ST*BA209FD*UP*085612216582
CTP**RTL*7
PID*F****Black Dog
PO4*144*************8

OUTPUT --> If you notice output the second loop of item is not having the PackQuantity and cbc:PackSizeNumeric is missing.. 

BUT INCASE that in input have different Value it works fine. in PO401 and PO414, the tag wont dissapear and it will output correct

<cac:GoodsItem>
    <cac:Item>
        <cbc:UUID>1</cbc:UUID>
        <cbc:Description>Cat Orange</cbc:Description>
        <cbc:Quantity>1007</cbc:Quantity>
        <cbc:PackQuantity>144</cbc:PackQuantity>
        <cbc:PackSizeNumeric>8</cbc:PackSizeNumeric>
        <cbc:Price>2.82</cbc:Price>
    </cac:Item>
    <cac:Item>
        <cbc:UUID>2</cbc:UUID>
        <cbc:Description>Black Dog/cbc:Description>
        <cbc:Quantity>2007</cbc:Quantity>
        <cbc:Price>1.58</cbc:Price>
    </cac:Item>
</cac:GoodsItem>

BUT INCASE that in input have different Value it works fine. in PO401 and PO414, the tag wont dissapear and it will output correct

EXAMPLE

INPUT
PO1*0000001129*90576*EA*2.82*PE*SK*1998788*ST*GB8FDC*UP*032251802706
CTP**RTL*7
PID*F****Cat Orange
PO4*144*************8
PO1*0000001444*24048*EA*1.58*PE*SK*1998802*ST*BA209FD*UP*085612216582
CTP**RTL*7
PID*F****Black Dog
PO4*111*************5

THEN OUPUT WOULD BE LIKE THIS
<cac:GoodsItem>
    <cac:Item>
        <cbc:UUID>1</cbc:UUID>
        <cbc:Description>Cat Orange</cbc:Description>
        <cbc:Quantity>1007</cbc:Quantity>
        <cbc:PackQuantity>144</cbc:PackQuantity>
        <cbc:PackSizeNumeric>8</cbc:PackSizeNumeric>
        <cbc:Price>2.82</cbc:Price>
    </cac:Item>
    <cac:Item>
        <cbc:UUID>2</cbc:UUID>
        <cbc:Description>Black Dog/cbc:Description>
        <cbc:Quantity>2007</cbc:Quantity>
        <cbc:PackQuantity>111</cbc:PackQuantity>
        <cbc:PackSizeNumeric>5</cbc:PackSizeNumeric>
        <cbc:Price>1.58</cbc:Price>
    </cac:Item>
</cac:GoodsItem>

Eppye Bots

unread,
Jul 1, 2022, 8:00:42 AM7/1/22
to 'Chuck Turco' via Bots Open Source EDI Translator
your looping is not OK (completely wrong, basic error).
please take a look at the examples provided in plugins and documentation.


kind regards, Henk-Jan Ebbers


--
You received this message because you are subscribed to the Google Groups "Bots Open Source EDI Translator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to botsmail+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/botsmail/850b5a14-226d-4468-bb35-1c1d90415909n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages