Hi,I am looking to start an integration with a new file format that I have just received and not sure if anyone would have any ideas on how to proceed.The file is a CSV file, however each line in the CSV is a different type (ie, the first line Order Header, Second Line Billing address, Third line Senders Address, fourth line, plus additional lines which are order lines, and the final is the order closure.This file could have multiple orders within, which complicates things a little more. So the above lines can be repeated.I did think initially, to make each line generic ie. Field1, Field2, Field3 etcBut the problem I have is how do I get the grammar to split the file, and also if they have multiple order lines how does it know when its no longer this order.I know there is next record block that can be used, but each line is different, and the file is a CSV.Here is a sample file;BA|Customer Name|3335782345|25508|billingaddress1|billingaddress2|billingaddress3|billingcity|billingcountrySA|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
HD|10212348765|20231012|2356789907|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|123458|A45683||bag|1|202.10|202.10|250.00|2356789907-1||20231021|20231020|20231021|20231020||happy birthday
PD|123459|A45682||bottle|1|202.10|202.10|250.00|2356789907-2||20231021|20231020|20231021|20231020||
TD|10212348765
A very messy file, but it's more about if anybody has any suggestions on how I handle the order line and the next order section to split the file up.
Many thanks
Lee
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/8b3a7468-a435-464e-ad86-7eda7862a26cn%40googlegroups.com.
Hi Henk,Thanks for coming back to me, sorry its a new one this format for me, as used to using columns.The question is with this format, how would I tell bots to split the file when the next HD (header)? just trying to get an idea of how the file would look. I have this so far;from bots.botsconfig import *
syntax = {
'field_sep': '|',
'charset': "utf-8",
'quote_char': '',
'merge':False,
#'noBOTSID':True,
}
structure= [
{ID:'HEADER',MIN:0,MAX:99999, LEVEL:[
{ID:'LINE',MIN:0,MAX:99999, LEVEL:[
{ID:'LINE2',MIN:0,MAX:99999, LEVEL:[
{ID:'LINE3',MIN:0,MAX:99999},
]},
]},
]}
]
recorddefs = {
'HEADER':[
['BOTSID','M',6,'A'],
['f1', 'C', 2, 'AN'],
['f2', 'C', 255, 'AN'],
['f3', 'C', 255, 'AN'],
['f4', 'C', 255, 'AN'],
['f5', 'C', 255, 'AN'],
['f6', 'C', 255, 'AN'],
['f7', 'C', 255, 'AN'],
['f8', 'C', 255, 'AN'],
['f9', 'C', 255, 'AN'],
['f10', 'C', 255, 'AN'],
['f11', 'C', 255, 'AN'],
['f12', 'C', 255, 'AN'],
['f13', 'C', 255, 'AN'],
['f14', 'C', 255, 'AN'],
['f15', 'C', 255, 'AN'],
['f16', 'C', 255, 'AN'],
['f17', 'C', 255, 'AN'],
],And how would I handle multiple order lines in this file?Thank you for your help and coming back to me Henk.Lee
To view this discussion on the web visit https://groups.google.com/d/msgid/botsmail/cb18bf94-8809-4770-85f6-54a3b6396a3bn%40googlegroups.com.