Conversion to x12 856

288 views
Skip to first unread message

David Friday

unread,
Oct 8, 2012, 6:08:05 PM10/8/12
to bots...@googlegroups.com
Hi,
 
I have already created a difficult CSV to x12 856 translation using Bots and I was wondering is there a easier format to start with other than CSV? Currently I export the relevant data from the database to CSV and then run a macro move the data around to create the HL lines, etc and then run through Bots.
Any suggestions of a better way would be very helpful.
 
Thanks anyway,
David

henk-jan ebbers

unread,
Oct 8, 2012, 7:03:15 PM10/8/12
to bots...@googlegroups.com
hi david,

I guess you are using csv with only one record-type? am I correct?

two possible ways to make this simpler:

1. look at the processing of these csv lines. I did this myself, it is not really simple but ...how did you do this?

2. use an inhouse-file that has these, or similar levels. You could do this in eg xml, flat fiel, csv with multiple record types, etc
Big issue here is: what if one edi-partner wants to have different levels as another edi-partner?
Any idea about this?

kind regards,
henk-jan
> --
>
>

David Friday

unread,
Oct 9, 2012, 11:59:11 AM10/9/12
to bots...@googlegroups.com
Hi henk-jan,
 
You are correct!
 
I did this by exporting the data into a csv file and then using excel created a macro that rearranged the data into the required fields so I could translate it using Bots.
 
At the moment I only have one trading partner that requires an 856 but I'm sure there will be more and I will probably just create another set of mappings, etc to meet there changes/requirements.
 
Thanks for your advice, I will keep trying to improve what I have already created using your suggestions.
 
Below are my input csv file layout and mapping so it may help others to use or improve what I have done.
 
[order.csv]
HEA,LDLLC,THEBUCKLE,ON456789,4
HLL,1,,S,CTN71,55,G,55,LB,1,2,UPSG,BM,125563,011,20120621,ST,The Buckle Inc,92,900,2915 W 16th Street,Suite x,Kearney,NE,68845,SF,Logistics Depot
HLL,2,1,O,,,,,,,,,,,,,BY,,92,900,,,,,,,,P0345678,120605,IV,9995511,IT,1122334
HLL,3,2,P,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,GM,00007287900000256222,GM,00007287900000256223,GM,00007287900000256224,GM,00007287900000256225
HLL,4,3,I,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,UP,BU12341234,30,EA
[\order.csv]
 
[Mapping]
#mapping-script
import time
import bots.transform as transform
def main(inn,out):
    out.put({'BOTSID':'ST','ST02':out.ta_info['reference'],'ST01':'856'})
    out.put({'BOTSID':'ST'},{'BOTSID':'BSN','BSN01':'00'}) #PURPOSE CODE 00=ORIGINAL
    out.put({'BOTSID':'ST'},{'BOTSID':'BSN','BSN02':out.ta_info['reference']})
    out.put({'BOTSID':'ST'},{'BOTSID':'BSN','BSN03':time.strftime('%y%m%d')})  #WRITES CURRENT DATE
    out.put({'BOTSID':'ST'},{'BOTSID':'BSN','BSN04':time.strftime('%H%M')})  #WRITES CURRENT TIME
    out.put({'BOTSID':'ST'},{'BOTSID':'BSN','BSN05':'0001'}) #PURPOSE CODE = 0001 Shipment
    for lin in inn.getloop({'BOTSID':'HEA'},{'BOTSID':'HLL'}):
        lou = out.putloop({'BOTSID':'ST'},{'BOTSID':'HL'})
        lou.put({'BOTSID':'HL','HL01':lin.get({'BOTSID':'HLL','HL01':None})})
        lou.put({'BOTSID':'HL','HL02':lin.get({'BOTSID':'HLL','HL02':None})})
        lou.put({'BOTSID':'HL','HL03':lin.get({'BOTSID':'HLL','HL03':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'TD1','TD101':lin.get({'BOTSID':'HLL','TD101INFO':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'TD1','TD102':lin.get({'BOTSID':'HLL','TD102INFO':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'TD1','TD106':lin.get({'BOTSID':'HLL','TD106INFO':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'TD1','TD107':lin.get({'BOTSID':'HLL','TD107INFO':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'TD1','TD108':lin.get({'BOTSID':'HLL','TD108INFO':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'TD5','TD501':lin.get({'BOTSID':'HLL','TD501INFO':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'TD5','TD502':lin.get({'BOTSID':'HLL','TD502INFO':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'TD5','TD503':lin.get({'BOTSID':'HLL','TD503INFO':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'REF','REF01':lin.get({'BOTSID':'HLL','REF01':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'REF','REF02':lin.get({'BOTSID':'HLL','REF02':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'DTM','DTM01':lin.get({'BOTSID':'HLL','DTM01':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'DTM','DTM02':lin.get({'BOTSID':'HLL','DTM02':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'N1','N101':lin.get({'BOTSID':'HLL','N101':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'N1','N102':lin.get({'BOTSID':'HLL','N102':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'N1','N103':lin.get({'BOTSID':'HLL','N103':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'N1','N104':lin.get({'BOTSID':'HLL','N104':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'N1'},{'BOTSID':'N3','N301':lin.get({'BOTSID':'HLL','N301':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'N1'},{'BOTSID':'N3','N302':lin.get({'BOTSID':'HLL','N302':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'N1'},{'BOTSID':'N4','N401':lin.get({'BOTSID':'HLL','N401':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'N1'},{'BOTSID':'N4','N402':lin.get({'BOTSID':'HLL','N402':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'N1'},{'BOTSID':'N4','N403':lin.get({'BOTSID':'HLL','N403':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'N1','N101':lin.get({'BOTSID':'HLL','N101A':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'N1','N102':lin.get({'BOTSID':'HLL','N102A':None})})
# New HLL line starts here
        lou.put({'BOTSID':'HL'},{'BOTSID':'PRF','PRF01':lin.get({'BOTSID':'HLL','PRF01':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'PRF','PRF04':lin.get({'BOTSID':'HLL','PRF04':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'REF','REF01':lin.get({'BOTSID':'HLL','REF01A':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'REF','REF02':lin.get({'BOTSID':'HLL','REF02A':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'REF','REF01':lin.get({'BOTSID':'HLL','REF01B':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'REF','REF02':lin.get({'BOTSID':'HLL','REF02B':None})})
# New HLL line starts here
        if lin.get({'BOTSID':'HLL','MAN01A':None}):
            lou.put({'BOTSID':'HL'},{'BOTSID':'MAN','MAN01':'GM','MAN02':lin.get({'BOTSID':'HLL','MAN02A':None})})
        if lin.get({'BOTSID':'HLL','MAN01B':None}):
            lou.put({'BOTSID':'HL'},{'BOTSID':'MAN','MAN01':'GM','MAN02':lin.get({'BOTSID':'HLL','MAN02B':None})})
        if lin.get({'BOTSID':'HLL','MAN01C':None}):
            lou.put({'BOTSID':'HL'},{'BOTSID':'MAN','MAN01':'GM','MAN02':lin.get({'BOTSID':'HLL','MAN02C':None})})
        if lin.get({'BOTSID':'HLL','MAN01D':None}):
            lou.put({'BOTSID':'HL'},{'BOTSID':'MAN','MAN01':'GM','MAN02':lin.get({'BOTSID':'HLL','MAN02D':None})})
        if lin.get({'BOTSID':'HLL','MAN01E':None}):
            lou.put({'BOTSID':'HL'},{'BOTSID':'MAN','MAN01':'GM','MAN02':lin.get({'BOTSID':'HLL','MAN02E':None})})
        if lin.get({'BOTSID':'HLL','MAN01F':None}):
            lou.put({'BOTSID':'HL'},{'BOTSID':'MAN','MAN01':'GM','MAN02':lin.get({'BOTSID':'HLL','MAN02F':None})})
        if lin.get({'BOTSID':'HLL','MAN01GB':None}):
            lou.put({'BOTSID':'HL'},{'BOTSID':'MAN','MAN01':'GM','MAN02':lin.get({'BOTSID':'HLL','MAN02G':None})})
# New HLL line starts here
        lou.put({'BOTSID':'HL'},{'BOTSID':'LIN','LIN02':lin.get({'BOTSID':'HLL','LIN02':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'LIN','LIN03':lin.get({'BOTSID':'HLL','LIN03':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'SN1','SN102':lin.get({'BOTSID':'HLL','SN102':None})})
        lou.put({'BOTSID':'HL'},{'BOTSID':'SN1','SN103':lin.get({'BOTSID':'HLL','SN103':None})})
    out.put({'BOTSID':'ST'},{'BOTSID':'CTT','CTT01':inn.get({'BOTSID':'HEA','CTT01':None})})
    out.put({'BOTSID':'ST'},{'BOTSID':'SE','SE01':out.getcount()+1,'SE02':out.ta_info['reference']})  #last line (counts the segments produced in out-message
[\Mapping]
 
Thanks again,
 
David
 

 

henk-jan ebbers

unread,
Oct 10, 2012, 9:30:33 AM10/10/12
to bots...@googlegroups.com
hi David,

will give some suggestions.

1. x12 users 'qualifiers'; typically you do not have qualifiers in your ERP softoware.
Eg in your ERP-software you have 'shipping date'; X12 has to field, one with the qualifier (this is is '011' ?), one with the date.

Best is to ONLY pass the shipping date itself in the inhouse (csv) files, add the qualifier in the mapping.
Example:
You now do:
lou.put({'BOTSID':'HL'},{'BOTSID':'REF','REF01':lin.get({'BOTSID':'HLL','REF01':None})})
lou.put({'BOTSID':'HL'},{'BOTSID':'REF','REF02':lin.get({'BOTSID':'HLL','REF02':None})})
I always do this like:
lou.put({'BOTSID':'HL'},{'BOTSID':'REF','REF01':'011','REF02':lin.get({'BOTSID':'HLL','REF02':None})})

This has 2 advantages:
1. use only your data in the inhouse file, add edi-specific data in the mapping (compare: you do not want printer-specific codes in your print-files, these are added later on by the printer-driver)
2. This avoid the if-constructiuons like:
if lin.get({'BOTSID':'HLL','MAN01A':None}):
lou.put({'BOTSID':'HL'},{'BOTSID':'MAN','MAN01':'GM','MAN02':lin.get({'BOTSID':'HLL','MAN02A':None})})
How this works (in the REF example above):
if there is no shipping date in the inhosue file, bots will not write the REF segment. And OTOH: if there is a shipping date, Bots will write it including the right qualifier.

will do other suggestion later on,

henk-jan
> --
>
>

henk-jan ebbers

unread,
Oct 10, 2012, 10:02:18 AM10/10/12
to bots...@googlegroups.com
other suggestions:

1. try to make the setup as simple as possible.I would (if I would make such a translation) avoid the excel-step.
what does the csv file look when it comes out of your system?

2. The second and 3rth field of your HLL record contain the HL-number, and teh references ot these numbers.
I can not image these are in your ERP-software, this si very edi-specific.
As these are very edi-specific, I always generate these in the mapping (using counters)

3. Apparently you have the levels of shipment, order, package and item in your system
I would try to ass these in specific records, eg:
HLS (shipment)
HLS (order)
HLP (package)
HLI (item)
You can make these records 'nested': 'under' HLS would be the HLO records of the shipment, 'under' each HLO would be the HLP records of the shipment, etc

hope this helps,

henk-jan


On 10/09/2012 05:59 PM, David Friday wrote:
> --
>
>

David Friday

unread,
Oct 10, 2012, 2:17:51 PM10/10/12
to bots...@googlegroups.com

Hi henk-jan,
 
Thank you for the excellent suggestions, I will make some of these changes and try to move away from the excel file.
 
David
 
 

David Friday

unread,
Oct 25, 2012, 11:10:59 AM10/25/12
to bots...@googlegroups.com
Hi henk-jan,,
 
In your previous reply you suggested that I use counters in the mapping to generate the HL segments. Would it be possible for you to provide me an example based on all the HL information e.g. HLS, HLO, HLI and HLP being on the same single line from a csv file. .
 
Thanks,
 
David

hjebbers

unread,
Oct 25, 2012, 11:24:58 AM10/25/12
to bots...@googlegroups.com
hi David,

I have this example below.
It is from production thing, truing to provide yo uthe essentials.
csv is csv with header and lines.

    #shipment
    hlcounter
= 1
    linecounter
= 1
   
out.put({'BOTSID':'ST'},{'BOTSID':'HL','HL01':hlcounter,'HL03':'S'})
    currentshipment
= hlcounter
    hlcounter
+= 1
   
   
#put shipment details
   
   
#per order
    lijstordernummers
= set([ordernummer.get({'BOTSID':'LIN','OrderNumber':None}) for ordernummer in inn.getloop({'BOTSID':'MES'},{'BOTSID':'LIN'})])
   
for ordernummer in lijstordernummers:
        ordernode
= out.putloop({'BOTSID':'ST'},{'BOTSID':'HL','HL01':hlcounter,'HL02':currentshipment,'HL03':'O'})
        currentorder
= hlcounter
        hlcounter
+= 1

       
#put order details

       
#per package/sscc
        lijstssccs
= set([sscc.get({'BOTSID':'LIN','SSCC':None}) for sscc in inn.getloop({'BOTSID':'MES'},{'BOTSID':'LIN','OrderNumber':ordernummer})])
       
for sscc in lijstssccs:
            ssccnode
= out.putloop({'BOTSID':'ST'},{'BOTSID':'HL','HL01':hlcounter,'HL02':currentorder,'HL03':'P'})
            currentsscc
= hlcounter
            hlcounter
+= 1
           
           
#put package details

           
#per line item
           
for lin in inn.getloop({'BOTSID':'MES'},{'BOTSID':'LIN','SSCC':sscc}):
                itemnode
= out.putloop({'BOTSID':'ST'},{'BOTSID':'HL','HL01':hlcounter,'HL02':currentsscc,'HL03':'I'})
                hlcounter
+= 1
               
               
#put line item details





kind regards,
henk-jan

aoplnx

unread,
Feb 8, 2016, 1:22:27 PM2/8/16
to Bots Open Source EDI Translator
Hi henk-jan 

I am working in mapping an 856 X12 from a CSV file

I am following your guidelines below for output the Shipping level but I can't get the output.
This is my mapping for this Shipping Level
 #shipment level*********************************************************************************
    hlcounter = 1       #HL segments have sequentail count
    shipment = out.putloop({'BOTSID':'ST'},{'BOTSID':'HL','HL01':hlcounter,'HL03':'S'})
    currentshipment = hlcounter     #remember the current counter, as child-HL segments have to point to this shipment
    hlcounter += 1
    
    shipment.put({'BOTSID':'HL'},{'BOTSID':'TD1','TD101':inn.get({'BOTSID':'HLS','Packaging_Code':None})})
    shipment.put({'BOTSID':'HL'},{'BOTSID':'TD1','TD102':inn.get({'BOTSID':'HLS','Lading_Quantity':None})})
    shipment.put({'BOTSID':'HL'},{'BOTSID':'TD1','TD106':inn.get({'BOTSID':'HLS','Weight_Qualifier':None})})
    shipment.put({'BOTSID':'HL'},{'BOTSID':'TD1','TD107':inn.get({'BOTSID':'HLS','Weight':None})})
    shipment.put({'BOTSID':'HL'},{'BOTSID':'TD1','TD108':inn.get({'BOTSID':'HLS','UnitOfMeasure_TD':None})})
    shipment.put({'BOTSID':'HL'},{'BOTSID':'TD5','TD502':inn.get({'BOTSID':'HLS','ID_Code_Qual_Td5':None})})
    shipment.put({'BOTSID':'HL'},{'BOTSID':'TD5','TD503':inn.get({'BOTSID':'HLS','ID_Code_Td5':None})})
    shipment.put({'BOTSID':'HL'},{'BOTSID':'TD5','TD504':inn.get({'BOTSID':'HLS','Transportation_Code':None})})
    shipment.put({'BOTSID':'HL'},{'BOTSID':'TD5','TD505':inn.get({'BOTSID':'HLS','Shipping_Carrier_Name':None})})

This is the result

ISA*00*          *00*          *01*NGPROD         *01*AOPROEDI       *160208*1212*U*00401*000000013*1*P*>~
GS*SH*NGPROD*AOPROEDI*20160208*1212*13*X*004010VICS~
ST*856*0322~
BSN*00*8182098369*150313*0253*0001~
HL*1**S~     
HL*2**O~
HL*4**T~
MAN*GM*00376130307061045602~
HL*4**I~
LIN**UK*00059800848138~
SN1**1*CA~
PO4*20~
PID*F*08***SMARTIES EASTER FRIENDS~
HL*5**I~
LIN**UK*00059800299206~
SN1**13*CA~
PO4*16~
PID*F*08***FAVOURITES SNACK SIZE~

As you can see I am not getting the information for Shipping level.
What I am doing wrong? Any help will be appreciated

Regards

Antonio

henk-jan ebbers

unread,
Feb 8, 2016, 1:37:22 PM2/8/16
to bots...@googlegroups.com
in bots.ini set get_checklevel to 2
check if you get anyting in those gets:
Packaging_Code = inn.get({'BOTSID':'HLS','Packaging_Code':None})
print 'Packaging_Code', Packaging_Code

(print statements should show on commandline)

kind regards,
henk-jan
> lijstordernummers =set([ordernummer.get({'BOTSID':'LIN','OrderNumber':None})forordernummer ininn.getloop({'BOTSID':'MES'},{'BOTSID':'LIN'})])
> forordernummer inlijstordernummers:
> ordernode =out.putloop({'BOTSID':'ST'},{'BOTSID':'HL','HL01':hlcounter,'HL02':currentshipment,'HL03':'O'})
> currentorder =hlcounter
> hlcounter +=1
>
> #put order details
>
> #per package/sscc
> lijstssccs =set([sscc.get({'BOTSID':'LIN','SSCC':None})forsscc ininn.getloop({'BOTSID':'MES'},{'BOTSID':'LIN','OrderNumber':ordernummer})])
> forsscc inlijstssccs:
> ssccnode =out.putloop({'BOTSID':'ST'},{'BOTSID':'HL','HL01':hlcounter,'HL02':currentorder,'HL03':'P'})
> currentsscc =hlcounter
> hlcounter +=1
>
> #put package details
>
> #per line item
> forlin ininn.getloop({'BOTSID':'MES'},{'BOTSID':'LIN','SSCC':sscc}):
> itemnode =out.putloop({'BOTSID':'ST'},{'BOTSID':'HL','HL01':hlcounter,'HL02':currentsscc,'HL03':'I'})
> hlcounter +=1
>
> #put line item details
>
>
> |
>
>
>
> kind regards,
> henk-jan
>
>
> On Thursday, October 25, 2012 5:11:00 PM UTC+2, David Friday wrote:
>
> Hi henk-jan,,
> In your previous reply you suggested that I use counters in the mapping to generate the HL segments. Would it be possible for you to provide me an example based on all the HL information
> e.g. HLS, HLO, HLI and HLP being on the same single line from a csv file. .
> Thanks,
> David
>
> --
> 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,
Feb 8, 2016, 2:20:04 PM2/8/16
to Bots Open Source EDI Translator
Hi henk-jan

Thank you.  I added those two lines I am getting this info....Packaging_code None... 
Now I am more confused because in my Grammar the HLS look O.K. Please see below part of Grammar and input cvs file

What I am missing?

recorddefs = {
    'HEA':[
            ['BOTSID','C',3,'A'],                         #pos 1
            ['TEST', 'C', 1, 'AN'],                       #pos 6
            ['PO_Originen', 'C', 2, 'AN'],                #pos 9
            ['PO_Type_Code', 'C', 2, 'AN'],               #pos 13
            ['PO_Number', 'C', 22, 'AN'],                 #pos 17
            ['PO_Number_Date', 'C', 8, 'AN'],             #pos 41
            ['FROMPARTENER', 'C', 15, 'AN'],              #pos 51
            ['TOPARTENER', 'C', 15, 'AN'],                #pos 68
            ['PO_FOB', 'C', 8, 'AN'],                     #pos 85
            ['Delivery_Requested_Date', 'C', 8, 'AN'],    #pos 95
            ['Requested_Pickup_Date', 'C', 8, 'AN'],      #pos 98
            ['Requested_Pickup_Time', 'C', 4, 'AN'],      #pos 108
            ['Department_Number', 'C', 2, 'AN'],          #pos 111
            ['Customer_Number', 'C', 6, 'AN'],            #pos 114
            ['Invoice_Date', 'C', 8, 'AN'],               #pos 114
            ['Invoice_Number', 'C', 22, 'AN'],            #pos 114
            ['Bsn_Tran_Code', 'C', 2, 'AN'],              #pos 3
            ['Bill_Lading_Number', 'C', 12, 'AN'],        #pos 9
            ['B_L_N_date', 'C', 6, 'AN'],                  #pos 26
            ['B_L_N_time', 'C', 4, 'AN'],                  #pos 35
            ['Hierarchical_Code', 'C', 4, 'AN'],           #pos 40
          ],
    'HLS':[
            ['BOTSID','C',3,'A'],                         #pos 1
            ['Packaging_Code', 'C', 5, 'AN'],             #pos 6
            ['Lading_Quantity', 'C', 7, 'AN'],            #pos 12  
            ['Weight_Qualifier', 'C', 2, 'AN'],           #pos 20
            ['Weight', 'C', 8, 'AN'],                     #pos 23
            ['UnitOfMeasure_TD', 'C', 2, 'AN'],           #pos 32
   ['ID_Code_Qual_Td5', 'C', 2, 'AN'],           #pos 39
            ['ID_Code_Td5', 'C', 10, 'AN'],               #pos 46 
            ['Transportation_Code', 'C', 1, 'AN'],        #pos 57
            ['Shipping_Carrier_Name', 'C', 20, 'AN'],     #pos 59
          ],
 
My cvs file look like this

HEA|P|00|SA|4804170173            |20150310|NGPROD         |AOPROEDI       |PP      |20150313|        |    |  |      |        |                      |00|8182098369  |150313|0253|0001                           
HLS|PLT  |143    |G |984.955 |KG|2 |CPLV      |M|CAL3U0              
RIF|BM|8182098369 |011|20150313|017|20150313
BIL|LOBLAWS INC                                                 |9 |2471916380099|1 PRESIDENT'S CHOICE CIRCLE   |BRAMPTON       |ON           |L6Y  5S5|CA
SHI|D028 Pickering Harmony Main SL                              |9 |2471916380028|1400 Church Street            |Pickering      |ON           |L1W 4C1 |CA
ORD|GM|00376130307061045602         
LIN|1         |CA|20  |UK|00059800848138|55        |SMARTIES EASTER FRIENDS                                                         |  | |    |  |          |         |  |          |  
LIN|13        |CA|16  |UK|00059800299206|121.64    |FAVOURITES SNACK SIZE                                                           |  | |    |  |          |         |  |          |  
LIN|1         |CA|24  |UK|00059800990806|21.11     |CRUNCH SNACK SIZE CHOC                                                          |  | |    |  |          |         |  |          |  
LIN|16        |CA|30  |UK|00059800675598|53.7      |KIT KAT 2F WHITE AND MILK MP                                                    |  | |    |  |          |         |  |          |  
LIN|1         |CA|1   |UK|00059800482219|1055.7    |NESTLE 6CT HP CHEP                                                              |  | |    |  |          |         |  |          |  
LIN|70        |CA|144 |UK|00059800499842|129.5     |MACKINTOSH TOFFEE BAR                                                           |  | |    |  |          |         |  |          |  
LIN|1         |CA|24  |UK|00059800990813|21.11     |BABY RUTH SNACK SIZE CHOC                                                       |  | |    |  |          |         |  |          |  
LIN|5         |CA|16  |UK|00059800451673|177.36    |NESTLE ASSORTED MULTIPACK                                                       |  | |    |  |          |         |  |          |  
LIN|27        |CA|32  |UK|00059800848442|57.28     |KIT KAT JUNIORS CHOCOLATE                                                       |  | |    |  |          |         |  |          |  
LIN|6         |CA|30  |UK|00059800855433|53.7      |NESTLE KITKAT CHOCOLATE MINT                                                    |  | |    |  |          |         |  |          |  
LIN|1         |CA|24  |UK|00059800990790|21.11     |BUTTERFINGER SNACK SZ CHOC                                                      |  | |    |  |          |         |  |          |  
LIN|8         |CA|22  |UK|00059800848459|39.38     |COFFEE CRISP JUNIORS CHOCOLATE 

Regards

Andres

henk-jan ebbers

unread,
Feb 8, 2016, 2:38:49 PM2/8/16
to bots...@googlegroups.com
in bots.ini set get_checklevel to 2

when this is 2 you'll get error when trying to access (via get, getloop etc) records/fields that are not OK according to grammar.
in your case:
HLS is nested under HEA.
so: inn.get({'BOTSID':'HLS','Packaging_Code':None})}) does not deliver a result.
but inn.get({'BOTSID':'HEA'},{'BOTSID':'HLS','Packaging_Code':None})})
will deliver a result.

tjhat is why in bots.ini set get_checklevel to 2 is useful.

kind regards,
henk-jan

aoplnx

unread,
Feb 8, 2016, 3:15:32 PM2/8/16
to Bots Open Source EDI Translator
Hi henk-jan

Thank you very much for your help. I added these two lines and now I can get the result that I was expecting

 Packaging_Code = inn.get({'BOTSID':'HEA'},{'BOTSID':'HLS','Packaging_Code':None})
 print 'Packaging_Code ', Packaging_Code   ------------->>> result is PLT

I will modifiy the rest of the mapping and make sure that I added the extra BOTSID:HEA

You save me a lot of headaches!!

Thank you again

Andres
Reply all
Reply to author
Forward
0 new messages