can you send the xml file and the xml grammar?
another way is to use a setting in config/bots.ini
mappingdebug = True
this gives the results of the put's and gets in the log file.
btw, no need to count segmetns if you do like this:
out.put({'BOTSID':'ST'},{'BOTSID':'SE','SE01':out.getcount()+1,'SE02':out.ta_info['reference'].zfill(4)})
(this always gives the right number of segments in SE)
kind regards,
henk-jan
On 05/08/2013 05:59 PM, Harold DeWayne wrote:
> All --
>
> I am havingmore issues building output from BOTS...
>
> I am working on an x12 204, mapping from XML. The XML grammar was generated successfully by bots-xml2botsgrammar and apparently has no problems, the X12 grammar is the standard 204004010 grammar,
> but in my map, I have the following:
>
>
> import bots.transform as transform
>
> def main(inn,out):
>
> # Create and initialize counter(s)
> segcount = 2
>
> # build the ST segment for output
> out.put({'BOTSID':'ST','ST01':'210','ST02':out.ta_info['reference'].zfill(4)})
>
> # build the B3 segment for output
> out.put({'BOTSID':'ST'},{'BOTSID':'B3','B302':inn.get({'BOTSID':'ShipmentInvoice','Summary__invoice':None})})
> out.put({'BOTSID':'ST'},{'BOTSID':'B3','B303':inn.get({'BOTSID':'ShipmentInvoice','Summary__primary_id':None})})
> out.put({'BOTSID':'ST'},{'BOTSID':'B3','B304':inn.get({'BOTSID':'ShipmentInvoice','Summary__pay_method':None})})
> out.put({'BOTSID':'ST'},{'BOTSID':'B3','B306':inn.get({'BOTSID':'ShipmentInvoice','Summary__invoice_date':None})})
> out.put({'BOTSID':'ST'},{'BOTSID':'B3','B307':inn.get({'BOTSID':'ShipmentInvoice','Summary__amount':None})})
> out.put({'BOTSID':'ST'},{'BOTSID':'B3','B311':inn.get({'BOTSID':'ShipmentInvoice','Summary__scac':None})})
> segcount += 1 # Count the B3 segment
>
> # build the SE segment for output
> out.put({'BOTSID':'ST'},{'BOTSID':'SE','SE01':segcount})
> out.put({'BOTSID':'ST'},{'BOTSID':'SE','SE02':out.ta_info['reference'].zfill(4)})
>
> I keep getting the following error from BOTS: MessageError: [S03]: Record "[['ST'], ['B3']]" occurs 0 times, min is 1.
>
> I have verified that I have all the mandatory elements are mapped for the B3 segment and that all he XML element are populated, so I figure I'm just not identifying the B3 segment correctly.
>
> Here's what I'm seeing in my engine.log file:
> 20130508 11:45:54 INFO engine : running route Clearpointt 2100
> 20130508 11:45:54 DEBUG engine : no import of "/var/www/html/bots-3.0.0/bots/usersys/routescripts/Clearpointt".
> 20130508 11:45:54 DEBUG engine : start communication channel "ClearpointtIn210" type file in.
> 20130508 11:45:54 DEBUG engine : no import of "/var/www/html/bots-3.0.0/bots/usersys/communicationscripts/ClearpointtIn210".
> 20130508 11:45:54 DEBUG engine : finished communication channel "ClearpointtIn210" type file in.
> 20130508 11:45:54 DEBUG engine : no import of "/var/www/html/bots-3.0.0/bots/usersys/mappings/translation".
> 20130508 11:45:54 DEBUG engine : start translating file "28874" editype "xmlnocheck" messagetype "PCOF_XML_TO_210".
> 20130508 11:45:54 DEBUG engine : read edi file "28874".
> 20130508 11:45:54 DEBUG engine : import "/var/www/html/bots-3.0.0/bots/usersys/grammars/xmlnocheck.PCOF_XML_TO_210".
> 20130508 11:45:54 DEBUG engine : Mappingscript "PCOF_XML_TO_x12_210_4010" translates messagetype "PCOF_XML_TO_210" to messagetype "210004010".
> 20130508 11:45:54 DEBUG engine : import "/var/www/html/bots-3.0.0/bots/usersys/mappings/xmlnocheck.PCOF_XML_TO_x12_210_4010".
> 20130508 11:45:54 DEBUG engine : run userscript "main" in "/var/www/html/bots-3.0.0/bots/usersys/mappings/xmlnocheck.PCOF_XML_TO_x12_210_4010".
> 20130508 11:45:54 DEBUG engine : Mappingscript "PCOF_XML_TO_x12_210_4010" finished.
> 20130508 11:45:54 DEBUG engine : Start writing output file editype "x12" messagetype "210004010".
> 20130508 11:45:54 DEBUG engine : import "/var/www/html/bots-3.0.0/bots/usersys/grammars/x12.210004010".
> 20130508 11:45:54 DEBUG engine : record "ST":
> 20130508 11:45:54 DEBUG engine : "ST01" : "210"
> 20130508 11:45:54 DEBUG engine : "ST02" : "0743"
> 20130508 11:45:54 DEBUG engine : record "SE":
> 20130508 11:45:54 DEBUG engine : "SE01" : "3"
> 20130508 11:45:54 DEBUG engine : "SE02" : "0743"
> 20130508 11:45:54 DEBUG engine : translated input file "28874".
> 20130508 11:45:54 DEBUG engine : start communication channel "ClearpointtOut.X12" type file out.
> 20130508 11:45:54 DEBUG engine : no import of "/var/www/html/bots-3.0.0/bots/usersys/communicationscripts/ClearpointtOut.X12".
> 20130508 11:45:54 DEBUG engine : finished communication channel "ClearpointtOut.X12" type file out.
> 20130508 11:45:54 DEBUG engine : finished route Clearpointt 2100
>
>
> Can anyone tell me what I'm doing wrong, please?
>
>
> Thanks.
> Harold DeWayne
>
>
> PS: Henk-Jan, BikeMike... thanks for all you've done for me in helping me to understand. I'm trying not to disturb you anymore than I have to.
> <
https://groups.google.com/groups/opt_out>> <
https://groups.google.com/groups/opt_out <
https://groups.google.com/groups/opt_out>