CSV Issue - Missing first column

52 views
Skip to first unread message

Lee Pedley

unread,
Oct 9, 2024, 7:04:40 AM10/9/24
to Bots Open Source EDI Translator
Hi All,

I am having an odd issue, which is probably down to me missing something or being to close to it, but was wondering if anyone can see what I am doing wrong.

I have created the grammar for the CSV of which I include a sample of the data being dumped;

HD|10212348763|20231012|2356789906|35678904444|custom...@test.com|20231020 BA|Customer Name|3335782345|25508|billingaddress1|billingaddress2|billingaddress3|billingcity|billingcountry SA|Customer Name|3335782345||25508|shippingaddress1|shippingaddress2|shippingaddress3|shippingcity|shippingstate|shippingcountry PD|123456|A45689||jeans|1|202.10|202.10|250.00|2356789906-1||20231021|20231020|20231021|20231020|201|happy birthday PD|123457|A45681||plastic bag|1|202.10|202.10|250.00|2356789906-2|2356789906-1|20231021|20231020|20231021|20231020|201|happy birthday TD|10212348763

The Grammar is as follows;

from bots.botsconfig import *

syntax = {
        'field_sep': '|',
        'charset':  "utf-8",
        'allow_lastrecordnotclosedproperly':True,
        }

nextmessageblock = ({'BOTSID':'HD','ORDER_NUMBER':None})

structure=    [
        {ID:'HD',MIN:0,MAX:99999, LEVEL:[
                {ID:'BA',MIN:0,MAX:99999, LEVEL:[
                        {ID:'SA',MIN:0,MAX:99999, LEVEL:[
                                {ID:'PD',MIN:0,MAX:99999, LEVEL:[
                                        {ID:'TD',MIN:0,MAX:99999},
                                ]}
                        ]}
                ]}
        ]}
        ]
recorddefs = {
    'HD':[
            ['BOTSID','M',6,'A'],
            ['RECORD_IND', 'C', 2, 'AN'],
            ['ORDER_NUMBER', 'C', 100, 'AN'],
            ['ORDER_DATE', 'C', 20, 'AN'],
            ['ORDER_ECOMNO', 'C', 20, 'AN'],
            ['MEMBERNO', 'C', 100, 'AN'],
            ['CUSTOMER_EMAIL', 'C', 255, 'AN'],
            ['SHIPPING_DEADLINE', 'C', 100, 'AN'],
         ],
    'BA':[
            ['BOTSID','M',6,'A'],
            ['RECORD_IND', 'C', 2, 'AN'],
            ['BILL_NAME', 'C', 100, 'AN'],
            ['BILL_PHONE', 'C', 20, 'AN'],
            ['BILL_POSTCODE', 'C', 10, 'AN'],
            ['BILL_ADD1', 'C', 100, 'AN'],
            ['BILL_ADD2', 'C', 100, 'AN'],
            ['BILL_ADD3', 'C', 100, 'AN'],
            ['BILL_ADD4', 'C', 100, 'AN'],
            ['BILL_COUNTRY', 'C', 100, 'AN'],
         ],
    'SA':[
            ['BOTSID','M',6,'A'],
            ['RECORD_IND', 'C', 2, 'AN'],
            ['SHIP_NAME', 'C', 100, 'AN'],
            ['SHIP_PHONE', 'C', 20, 'AN'],
            ['SHIP_PHONE2', 'C', 20, 'AN'],
            ['SHIP_POSTCODE', 'C', 10, 'AN'],
            ['SHIP_ADD1', 'C', 100, 'AN'],
            ['SHIP_ADD2', 'C', 100, 'AN'],
            ['SHIP_ADD3', 'C', 100, 'AN'],
            ['SHIP_ADD4', 'C', 100, 'AN'],
            ['SHIP_ADD5', 'C', 100, 'AN'],
            ['SHIP_COUNTRY', 'C', 100, 'AN'],
         ],
    'PD':[
            ['BOTSID','M',6,'A'],
            ['RECORD_IND', 'C', 2, 'AN'],
            ['RETAIL_SKU', 'C', 20, 'AN'],
            ['VENDOR_SKU', 'C', 20, 'AN'],
            ['GTIN', 'C', 30, 'AN'],
            ['DESCRIPTION', 'C', 255, 'AN'],
            ['QUANTITY', 'C', 10, 'AN'],
            ['UNIT_GROSS', 'C', 10, 'AN'],
            ['UNIT_NET', 'C', 10, 'AN'],
            ['SELLING_PRICE', 'C', 10, 'AN'],
            ['CONSIGNMENT_NO', 'C', 30, 'AN'],
            ['CONSIGNMENT_ID', 'C', 30, 'AN'],
            ['PREF_DEL_DATE', 'C', 20, 'AN'],
            ['ESTIMATED_DATE', 'C', 20, 'AN'],
            ['EXPECTED_DATE', 'C', 20, 'AN'],
            ['SHIP_DEADLINE', 'C', 20, 'AN'],
            ['WAREHOUSE_CODE', 'C', 20, 'AN'],
            ['GIFT_MESSAGE', 'C', 255, 'AN'],
         ],
    'TD':[
            ['BOTSID','M',6,'A'],
            ['RECORD_IND', 'C', 2, 'AN'],
            ['ORDER_NUMBER', 'C', 2, 'AN'],
    ],

    }

When I run this I get the following error

MessageError: [F05] line 1 pos 1: Record "HD" field "RECORD_IND" too big (max 2): "10212348763". [F05] line 2 pos 1: Record "HD-BA" field "RECORD_IND" too big (max 2): "Customer Name". [F05] line 2 pos 1: Record "HD-BA" field "BILL_POSTCODE" too big (max 10): "billingaddress1". [F05] line 3 pos 1: Record "HD-BA-SA" field "RECORD_IND" too big (max 2): "Customer Name". [F05] line 3 pos 1: Record "HD-BA-SA" field "SHIP_POSTCODE" too big (max 10): "shippingaddress1". [F05] line 4 pos 1: Record "HD-BA-SA-PD" field "RECORD_IND" too big (max 2): "123456". [F05] line 4 pos 1: Record "HD-BA-SA-PD" field "SELLING_PRICE" too big (max 10): "2356789906-1". [F05] line 5 pos 1: Record "HD-BA-SA-PD" field "RECORD_IND" too big (max 2): "123457". [F05] line 5 pos 1: Record "HD-BA-SA-PD" field "SELLING_PRICE" too big (max 10): "2356789906-2". [F05] line 6 pos 1: Record "HD-BA-SA-PD-TD" field "RECORD_IND" too big (max 2): "10212348763". Found at least 10 errors.

It looks like it's missing the first column and going to the next, maybe something easy to fix? but I am clearly doing something wrong.

Thank you for your help on this.

Lee

Henk-Jan Ebbers

unread,
Oct 9, 2024, 7:18:22 AM10/9/24
to bots...@googlegroups.com

RECORD_IND = BOTSID

use nextmessage, not nextmessageblock.

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/249888a1-ca06-49d8-9921-b70c863c8e45n%40googlegroups.com.

Lee Pedley

unread,
Oct 9, 2024, 7:26:01 AM10/9/24
to Bots Open Source EDI Translator
Thank you Henk, you are amazing.  I know it was something simple and that fixed it.  

Thank you once again.

Lee

Henk-Jan Ebbers

unread,
Oct 9, 2024, 12:56:01 PM10/9/24
to bots...@googlegroups.com
thank you.
kind regards, henk-jan ebbers


Reply all
Reply to author
Forward
0 new messages