X12 Transportation EDI Documents

573 views
Skip to first unread message

aoplnx

unread,
Jan 26, 2016, 3:22:38 PM1/26/16
to Bots Open Source EDI Translator
Hi henk-jan 

Here in Canada we use X12 for interchanges the following EDI documents related to  transportation
204 Load Tender
990 Response to Load Tender
210 Detail Invoice for Transportation
214 Shipment Status

My question is do you have the grammar in bots for the above documents?
Or we can start from scratch and build the grammar some how?

Regards

Antonio 

Tom Westrick

unread,
Jan 26, 2016, 3:34:02 PM1/26/16
to Bots Open Source EDI Translator

aoplnx

unread,
Jan 27, 2016, 9:38:26 AM1/27/16
to Bots Open Source EDI Translator
Hi 

I looking for these specific grammar document if somebody already have them or bots have them in some place

204004010.py
990004010.py
210004010.py
214004010.py

I am not looking for the entire 4010 grammar. I already have it

Regards

Antonio

Tom Westrick

unread,
Jan 27, 2016, 11:49:23 AM1/27/16
to Bots Open Source EDI Translator

aoplnx

unread,
Jan 27, 2016, 12:03:47 PM1/27/16
to Bots Open Source EDI Translator
Hi Tom

Thank you very much!!..for some reason I didn't see at first glance.
This is exactly what I need!

Regards

Antonio

Jeremy Cowgar

unread,
Jan 27, 2016, 12:05:16 PM1/27/16
to bots...@googlegroups.com
Where do you put these files then?

For example, extract them to /usr/local/lib/python2.7/site-packages/bots/usersys/grammars/x12 ?

Jeremy

--
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.
For more options, visit https://groups.google.com/d/optout.

Tom Westrick

unread,
Jan 27, 2016, 12:06:36 PM1/27/16
to Bots Open Source EDI Translator
Exactly. The records004010.py goes there too.

Jeremy Cowgar

unread,
Jan 27, 2016, 12:16:07 PM1/27/16
to bots...@googlegroups.com
When I do that, I get  an error when running bots-engine.py and trying to process an incoming X12 file:

MessageError: 'x12' object has no attribute ‘recorddefs'

Thanks for any tips!

Jeremy


Tom Westrick

unread,
Jan 27, 2016, 12:24:34 PM1/27/16
to Bots Open Source EDI Translator



You need to copy records004010.py or whatever X12 version you are using into the same folder as each grammar references it.


-Tom

Jeremy Cowgar

unread,
Jan 27, 2016, 3:19:48 PM1/27/16
to bots...@googlegroups.com
OK, I’m getting closer…

I’m working with 5010, x12, specifically 837 and 834. I uncompressed X12.5010 into /usr/local/lib/python2.7/site-packages/bots/usersys/grammars/x12

Looking at 837005010.py, I see:

from bots.botsconfig import *                                                  
from records005010 import recorddefs

already. I then created a route to convert the EDI file to XML, Fromeditype: x12, Formedimessagetype: 837005010

When running bots-engine.py now, I get From/To partner fields filled in but still receive an error:

MessageError: [S50]: Line:1 pos:1 record:"ISA": message has an error in its structure; this record is not allowed here. Scanned in message definition until mandatory record: "ST".

I’ve tried many production EDI files, all of which process fine in our current system and I see no error with. ISA, GS, ST … SE, GE, IEA. Did I configure something wrong here to do with the EDI parsing?

Jeremy

BikeMike

unread,
Jan 27, 2016, 7:25:40 PM1/27/16
to Bots Open Source EDI Translator
Hi Jeremy,

frommessagetype should also be x12 in your route.
Bots automatically figures out the exact message type from the envelope content (for x12 or edifact)

I think your grammars/x12 folder must also contain:
x12.py
x12syntax.py
enveloperecords.py
(I got these from an x12 plugin, they are not in the downloaded grammar sets, but probably should be)

Kind Regards,
Mike

Jeremy Cowgar

unread,
Jan 28, 2016, 12:21:59 PM1/28/16
to bots...@googlegroups.com
Thanks! That got things working!

Jeremy

aoplnx

unread,
Mar 10, 2016, 6:45:09 PM3/10/16
to Bots Open Source EDI Translator
Hi Henk-Jan
I am stuck tryng to get this below result:

0204HDN7|TL2W_53D|TF
0204LDS5|1|RT|||
0204LG62|37|20160207|I|1620
0204LG62|38|20160207|K|1620
0204LDS5|2|LD|29173|L|18
0204LG62|37|20160207|I|1621
0204LG62|38|20160207|K|1621
0204LDS5|3|UL|29173|L|18
0204LG62|53|20160207|G|2000
0204LG62|54|20160207|L|2000
0204LDS5|4|CL|||
0204LG62|37|20160208|G|0009
0204LG62|38|20160208|L|0009

Instead I getting this result
0204HDN7|TL2W_53D|TF
0204LDS5|1|RT|||
0204LG62|37|20160207|I|1620
0204LG62|38|20160207|K|1620
0204LG62|37|20160207|I|1621
0204LG62|38|20160207|K|1621
0204LG62|53|20160207|G|2000
0204LG62|54|20160207|L|2000
0204LG62|37|20160208|G|0009
0204LG62|38|20160208|L|0009
0204LDS5|2|LD|29173|L|18
0204LDS5|3|UL|29173|L|18
0204LDS5|4|CL|||

This is part of my GRAMMAR
{ID:'0000204H',MIN:1,MAX:10000,
        QUERIES:{
            'frompartner':    {'BOTSID':'0000204H','FROMPARTENER':None},
            'topartner':      {'BOTSID':'0000204H','TOPARTENER':None},
            'reference':      {'BOTSID':'0000204H','Load_Number':None},
            'reference_date': {'BOTSID':'0000204H','Translate_Date':None},
            'reference_time': {'BOTSID':'0000204H','Translate_Time':None},
            'testindicator':  {'BOTSID':'0000204H','TEST':None}},
            
        LEVEL:[
            {ID:'0204HDB2',MIN:1,MAX:1},
            {ID:'0204HL11',MIN:1,MAX:3},
            {ID:'0204HAT5',MIN:1,MAX:1},
            {ID:'0204HNTE',MIN:1,MAX:2},
            {ID:'0204HDN1',MIN:0,MAX:2,LEVEL:[
                {ID:'0204HDN3',MIN:0,MAX:2},
       {ID:'0204HDN4',MIN:0,MAX:2},
    ]},
       {ID:'0204HDN7',MIN:1,MAX:1},
       {ID:'0204LDS5',MIN:1,MAX:100,LEVEL:[
           {ID:'0204LG62',MIN:0,MAX:99},
       {ID:'0204LDN1',MIN:0,MAX:99},
       {ID:'0204LDN3',MIN:0,MAX:99},
       {ID:'0204LDN4',MIN:0,MAX:99},
       {ID:'0204LG61',MIN:0,MAX:99},
                
This is part of my Mapping
    for linss in inn.getloop({'BOTSID':'ST'},{'BOTSID':'S5'}):
       linS5 = out.putloop({'BOTSID':'0000204H'},{'BOTSID':'0204LDS5'})
       linS5.put({'BOTSID':'0204LDS5','Stop_Sequence_Number':linss.get({'BOTSID':'S5','S501':None})})
       linS5.put({'BOTSID':'0204LDS5','Stop_Reason_Code':linss.get({'BOTSID':'S5','S502':None})})
       linS5.put({'BOTSID':'0204LDS5','Weight':linss.get({'BOTSID':'S5','S503':None})})
       linS5.put({'BOTSID':'0204LDS5','Weight_Unit_Code':linss.get({'BOTSID':'S5','S504':None})})
       linS5.put({'BOTSID':'0204LDS5','Number_of_Units_Shipped':linss.get({'BOTSID':'S5','S505':None})})
       #
    for lin62 in inn.getloop({'BOTSID':'ST'},{'BOTSID':'S5'},{'BOTSID':'G62'}):
       linS62 = out.putloop({'BOTSID':'0000204H'},{'BOTSID':'0204LDS5'},{'BOTSID':'0204LG62'})
       linS62.put({'BOTSID':'0204LG62','S_Date_Qualifier':lin62.get({'BOTSID':'G62','G6201':None})})
       linS62.put({'BOTSID':'0204LG62','S_Date':lin62.get({'BOTSID':'G62','G6202':None})})
       linS62.put({'BOTSID':'0204LG62','S_Time_Qualifier':lin62.get({'BOTSID':'G62','G6203':None})})
       linS62.put({'BOTSID':'0204LG62','S_Time':lin62.get({'BOTSID':'G62','G6204':None})})
       ##
       #linS5.put({'BOTSID':'0204LDS5'},{'BOTSID':'0204LG62','S_Date_Qualifier':linss.get({'BOTSID':'S5'},{'BOTSID':'G62','G6201':None})})
       #linS5.put({'BOTSID':'0204LDS5'},{'BOTSID':'0204LG62','S_Date':linss.get({'BOTSID':'S5'},{'BOTSID':'G62','G6202':None})})
       #linS5.put({'BOTSID':'0204LDS5'},{'BOTSID':'0204LG62','S_Time_Qualifier':linss.get({'BOTSID':'S5'},{'BOTSID':'G62','G6203':None})})
       #linS5.put({'BOTSID':'0204LDS5'},{'BOTSID':'0204LG62','S_Time':linss.get({'BOTSID':'S5'},{'BOTSID':'G62','G6204':None})})
       #
       
       I try to get S5 - G62 loop in several way but I can't get the result that I want.
       Could you please point me what I am doing wrong.
       
       Thank you
       
        Antonio
       

On Tuesday, January 26, 2016 at 3:34:02 PM UTC-5, Tom Westrick wrote:

BikeMike

unread,
Mar 11, 2016, 2:40:02 AM3/11/16
to Bots Open Source EDI Translator
I think you need nested loops

    for linss in inn.getloop({'BOTSID':'ST'},{'BOTSID':'S5'}):


       
for lin62 in linss.getloop({'BOTSID':'S5'},{'BOTSID':'G62'}):


aoplnx

unread,
Mar 11, 2016, 9:12:57 AM3/11/16
to Bots Open Source EDI Translator
Thank you Mike for your reply

Still  I am getting this error when  I follow your advice
"MappingFormatError: Parameter mpath is not valid according to grammar: ({'BOTSIDnr': u'1', 'BOTSID': 'S5'}, {'BOTSIDnr': u'1', 'BOTSID': 'G62'})

Ths is how I modifierd the mapping:

for linss in inn.getloop({'BOTSID':'ST'},{'BOTSID':'S5'}): linS5 = out.putloop({'BOTSID':'0000204H'},{'BOTSID':'0204LDS5'}) linS5.put({'BOTSID':'0204LDS5','Stop_Sequence_Number':linss.get({'BOTSID':'S5','S501':None})}) linS5.put({'BOTSID':'0204LDS5','Stop_Reason_Code':linss.get({'BOTSID':'S5','S502':None})}) linS5.put({'BOTSID':'0204LDS5','Weight':linss.get({'BOTSID':'S5','S503':None})}) linS5.put({'BOTSID':'0204LDS5','Weight_Unit_Code':linss.get({'BOTSID':'S5','S504':None})}) linS5.put({'BOTSID':'0204LDS5','Number_of_Units_Shipped':linss.get({'BOTSID':'S5','S505':None})}) # for lin62 in inn.getloop({'BOTSID':'S5'},{'BOTSID':'G62'}): linS62 = out.putloop({'BOTSID':'0204LDS5'},{'BOTSID':'0204LG62'}) linS62.put({'BOTSID':'0204LG62','S_Date_Qualifier':lin62.get({'BOTSID':'G62','G6201':None})}) linS62.put({'BOTSID':'0204LG62','S_Date':lin62.get({'BOTSID':'G62','G6202':None})}) linS62.put({'BOTSID':'0204LG62','S_Time_Qualifier':lin62.get({'BOTSID':'G62','G6203':None})}) linS62.put({'BOTSID':'0204LG62','S_Time':lin62.get({'BOTSID':'G62','G6204':None})}) ## ".Could you please point me twhat I am doing wrong

REgards

Antonio

aoplnx

unread,
Mar 12, 2016, 9:30:02 PM3/12/16
to Bots Open Source EDI Translator
Hi 
Somebody can help me to resolve this issue or point me to the right direction
"MappingFormatError: Parameter mpath is not valid according to grammar: ({'BOTSIDnr': u'1', 'BOTSID': 'S5'}, {'BOTSIDnr': u'1', 'BOTSID': 'G62'})
Regards

Antonio

On Friday, March 11, 2016 at 9:12:57 AM UTC-5, aoplnx wrote:
Thank you Mike for your reply "MappingFormatError: Parameter mpath is not valid according to grammar: ({'BOTSIDnr': u'1', 'BOTSID': 'S5'}, {'BOTSIDnr': u'1', 'BOTSID': 'G62'})

Still  I am getting this error when  I follow your advice

BikeMike

unread,
Mar 13, 2016, 5:15:29 AM3/13/16
to Bots Open Source EDI Translator
Hi, you did not copy my nested loop example correctly.

The second loop is not inn.getloop, it is linss.getloop!

aoplnx

unread,
Mar 13, 2016, 11:05:12 AM3/13/16
to Bots Open Source EDI Translator
Thank you BikeMike for your reply

If I do this :

   for linss in inn.getloop({'BOTSID':'ST'},{'BOTSID':'S5'}):
       linS5 = out.putloop({'BOTSID':'0000204H'},{'BOTSID':'0204LDS5'})
       linS5.put({'BOTSID':'0204LDS5','Stop_Sequence_Number':linss.get({'BOTSID':'S5','S501':None})})
       linS5.put({'BOTSID':'0204LDS5','Stop_Reason_Code':linss.get({'BOTSID':'S5','S502':None})})
       linS5.put({'BOTSID':'0204LDS5','Weight':linss.get({'BOTSID':'S5','S503':None})})
       linS5.put({'BOTSID':'0204LDS5','Weight_Unit_Code':linss.get({'BOTSID':'S5','S504':None})})
       linS5.put({'BOTSID':'0204LDS5','Number_of_Units_Shipped':linss.get({'BOTSID':'S5','S505':None})})
       #for linss in inn.getloop({'BOTSID':'ST'},{'BOTSID':'S5'}):
       #
       for lin62 in linss.getloop({'BOTSID':'S5'},{'BOTSID':'G62'}):
       #for lin62 in inn.getloop({'BOTSID':'S5'},{'BOTSID':'G62'}):
          linS62 = out.putloop({'BOTSID':'0204LDS5'},{'BOTSID':'0204LG62'})
          linS62.put({'BOTSID':'0204LG62','S_Date_Qualifier':lin62.get({'BOTSID':'G62','G6201':None})})
          linS62.put({'BOTSID':'0204LG62','S_Date':lin62.get({'BOTSID':'G62','G6202':None})})
          linS62.put({'BOTSID':'0204LG62','S_Time_Qualifier':lin62.get({'BOTSID':'G62','G6203':None})})
          linS62.put({'BOTSID':'0204LG62','S_Time':lin62.get({'BOTSID':'G62','G6204':None})})
       ##
I am getting this error:

"MappingRootError: Error in root putloop "{'BOTSIDnr': u'1', 'BOTSID': u'0204LDS5'}".

Then when I added this line
linS62 = out.putloop({'BOTSID':'0000204H'},{'BOTSID':'0204LDS5'},{'BOTSID':'0204LG62'})

I am getting a result but no the result that I expected
0204LDS5|1|RT|||
0204LG62|37|20160207|I|1620
0204LG62|38|20160207|K|1620
0204LG62|37|20160207|I|1621
0204LG62|38|20160207|K|1621
0204LG62|53|20160207|G|2000
0204LG62|54|20160207|L|2000
0204LG62|37|20160208|G|0009
0204LG62|38|20160208|L|0009
0204LDS5|2|LD|29173|L|18
0204LDS5|3|UL|29173|L|18
0204LDS5|4|CL|||

Could you please take a look and point me to what I am doing wrong. in the previous entry I copy the grammar and the file that I expected

Regards

Antonio
".

aoplnx

unread,
Mar 14, 2016, 12:10:01 PM3/14/16
to Bots Open Source EDI Translator
Hi Team
Can somebody help me and pointing me to where I am doing wrong.
I am following the looping inside the looping from this package x12toxml_retailer_version_850-856-810-997_20130807. But still can't get the result that I expecting

Regards

Antonio

henk-jan ebbers

unread,
Mar 14, 2016, 12:22:02 PM3/14/16
to bots...@googlegroups.com
dear Antonio,

try to use names that have more meaning.
it is important!
somebody will one day have to maintain this. be gentle for that person!

probably it is this line that goes wrong
linS62 = out.putloop({'BOTSID':'0204LDS5'},{'BOTSID':'0204LG62'})
you are probably intending to write somewhere in linS5 node.
but what you actually do is write to the out-noide.
So should be:
linS62 = linS5.putloop({'BOTSID':'0204LDS5'},{'BOTSID':'0204LG62'})


kind regards,
henk-jan
> -- 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 <mailto:botsmail+u...@googlegroups.com>. For more options, visit https://groups.google.com/d/optout.

aoplnx

unread,
Mar 14, 2016, 1:32:38 PM3/14/16
to Bots Open Source EDI Translator
Hi Hen-Jan

Thank you very much for your reply! I have been doing several simple mapping but this was the first time that I encounter a loop inside a loop. I tried to discovered what I was doing wrong looking many of the program that boot already have and you share with everybody.
I totally agree with your comment. Actually at the actual coding I adding some comment in order to anybody else can follow it later.

Now everything make more sense to me.

I really appreciated your time. I am getting the result that I expected

0204LDS5|1|RT|||
0204LG62|37|20160207|I|1620
0204LG62|38|20160207|K|1620
0204LDS5|2|LD|29173|L|18
0204LG62|37|20160207|I|1621
0204LG62|38|20160207|K|1621
0204LDS5|3|UL|29173|L|18
0204LG62|53|20160207|G|2000
0204LG62|54|20160207|L|2000
0204LDS5|4|CL|||
0204LG62|37|20160208|G|0009
0204LG62|38|20160208|L|0009

Thank you again

Antonio
Reply all
Reply to author
Forward
0 new messages