for lin in inn.getloop({'BOTSID':'054'}): lou = out.putloop({'BOTSID':'UNH'},{'BOTSID':'LIN'}) lou.put({'BOTSID':'LIN'}, {'BOTSID':'QTY','C186.6063':'21','C186.6060':lin.get ({'BOTSID':'054','Quantity':None})}) #write some more stuff
The problem is that for each inout-line a new UNH-segment is created while a new UNH-segment should only be created when the REFNUMBER changes.
A changed REFNUMBER signals a new order from another customer of my company within the EDI-order that is sent to the supplier.
I've worked quite long with the BOTS-Framework and it works like a charm but I couldn't solve the mentioned problem. Can someone please give me a hint?
there is a thing for this. in a grammar use nextmessageblock in plugin edifact_orders2csv this is demonstrated. in the nextmessageblock you specify which 'trigger' must be used to split up the incoming file in 'messages'; as long as the value of the trigger changes, bots considers it to be one message; all lines belonging to this message are send as one 'block'.
> for lin in inn.getloop({'BOTSID':'054'}): > lou = out.putloop({'BOTSID':'UNH'},{'BOTSID':'LIN'}) > lou.put({'BOTSID':'LIN'}, > {'BOTSID':'QTY','C186.6063':'21','C186.6060':lin.get > ({'BOTSID':'054','Quantity':None})}) > #write some more stuff
> The problem is that for each inout-line a new UNH-segment is created > while a new UNH-segment should only be created when the REFNUMBER > changes.
> A changed REFNUMBER signals a new order from another customer of my > company within the EDI-order that is sent to the supplier.
> I've worked quite long with the BOTS-Framework and it works like a > charm but I couldn't solve the mentioned problem. Can someone please > give me a hint?
Traceback (most recent call last): ScriptError: Script file "C: \Python26\lib\site-packages\bots\bots.usersys\mappings \fixed.FixedToEdi": "Traceback (most recent call last): MpathRootError: get(({'SUPPLIER': None, 'BOTSID': '054'},)): "root" of incoming message is empty; either split messages or use inn.getloop ".
I don't get the trick what is wrong about this.
I also don't have a nested recordset where each "HEA"-line has several "LIN".lines below it like shown with the CSV-examples.
How can I model this? As far as I I've occupied me with the framework it shouldn't be difficult at all but I'm a python-newbie.and thankful for every hint.
kind regards, Markus
On 18 Dez., 15:10, henk-jan ebbers <hjebb...@gmail.com> wrote:
> there is a thing for this. > in a grammar use nextmessageblock > in plugin edifact_orders2csv this is demonstrated. > in the nextmessageblock you specify which 'trigger' must be used to > split up the incoming file in 'messages'; > as long as the value of the trigger changes, bots considers it to be one > message; > all lines belonging to this message are send as one 'block'.
> kind regards, > henk-jan
> Markus Imhof wrote: > > Hi everyone,
> > i have a fixed-width file and want to generate an EDI-order from it.
> > Each line has an record identifier at the beginning ('054') and has > > header-information for the order plus informations about the article.
> > for lin in inn.getloop({'BOTSID':'054'}): > > lou = out.putloop({'BOTSID':'UNH'},{'BOTSID':'LIN'}) > > lou.put({'BOTSID':'LIN'}, > > {'BOTSID':'QTY','C186.6063':'21','C186.6060':lin.get > > ({'BOTSID':'054','Quantity':None})}) > > #write some more stuff
> > The problem is that for each inout-line a new UNH-segment is created > > while a new UNH-segment should only be created when the REFNUMBER > > changes.
> > A changed REFNUMBER signals a new order from another customer of my > > company within the EDI-order that is sent to the supplier.
> > I've worked quite long with the BOTS-Framework and it works like a > > charm but I couldn't solve the mentioned problem. Can someone please > > give me a hint?
> Traceback (most recent call last): ScriptError: Script file "C: > \Python26\lib\site-packages\bots\bots.usersys\mappings > \fixed.FixedToEdi": "Traceback (most recent call last): > MpathRootError: get(({'SUPPLIER': None, 'BOTSID': '054'},)): "root" of > incoming message is empty; either split messages or use inn.getloop > ".
3. to solve this error take a look at the specific script in plugin edifact_orders2csv when I made the plugin I had the same error you had, and I solved in this script.
> I also don't have a nested recordset where each "HEA"-line has several > "LIN".lines below it like shown with the CSV-examples.
> How can I model this? As far as I I've occupied me with the framework > it shouldn't be difficult at all but I'm a python-newbie.and thankful > for every hint.
> kind regards, > Markus
> On 18 Dez., 15:10, henk-jan ebbers <hjebb...@gmail.com> wrote:
>> Hai markus,
>> there is a thing for this. >> in a grammar use nextmessageblock >> in plugin edifact_orders2csv this is demonstrated. >> in the nextmessageblock you specify which 'trigger' must be used to >> split up the incoming file in 'messages'; >> as long as the value of the trigger changes, bots considers it to be one >> message; >> all lines belonging to this message are send as one 'block'.
>> kind regards, >> henk-jan
>> Markus Imhof wrote:
>>> Hi everyone,
>>> i have a fixed-width file and want to generate an EDI-order from it.
>>> Each line has an record identifier at the beginning ('054') and has >>> header-information for the order plus informations about the article.
>>> for lin in inn.getloop({'BOTSID':'054'}): >>> lou = out.putloop({'BOTSID':'UNH'},{'BOTSID':'LIN'}) >>> lou.put({'BOTSID':'LIN'}, >>> {'BOTSID':'QTY','C186.6063':'21','C186.6060':lin.get >>> ({'BOTSID':'054','Quantity':None})}) >>> #write some more stuff
>>> The problem is that for each inout-line a new UNH-segment is created >>> while a new UNH-segment should only be created when the REFNUMBER >>> changes.
>>> A changed REFNUMBER signals a new order from another customer of my >>> company within the EDI-order that is sent to the supplier.
>>> I've worked quite long with the BOTS-Framework and it works like a >>> charm but I couldn't solve the mentioned problem. Can someone please >>> give me a hint?
I've setup a partner with the supplier ILN as partner-id and the email of the message sender. The email itself has an attachment with the EDI- message.
I'm not referencing the toPartner-variable from within my translation so I'm curious what has happened there?
regards, Markus
PS: is there a way to automate the processing of all routes, e.g.a run each two hours instead of clicking manually on the browser?
looks like a (smaller) bug. I will have a look at it. can you set 2 things in infog/bots.ini: debug = True log_file_level = DEBUG that gives some more clues about what went wrong. could you can send the log file for the error (after running with the changed setting)?
about the automating: no, Bots does no scheduling. but all OS'es have scheduling tools (eg CRON)
> I've setup a partner with the supplier ILN as partner-id and the email > of the message sender. The email itself has an attachment with the EDI- > message.
> I'm not referencing the toPartner-variable from within my translation > so I'm curious what has happened there?
> regards, > Markus
> PS: is there a way to automate the processing of all routes, e.g.a run > each two hours instead of clicking manually on the browser?
InvoicePOP3IN (which is the name of my In-Channel for POP3)
Another thing is that I attach the EDI-message to the email but I could not find out whether this is the correct procedure (e.g. instead of using the mail body)..
> about the automating: > no, Bots does no scheduling. > but all OS'es have scheduling tools (eg CRON)
That is what was my initial thought, too. But is there a python-script that can be called in order to run one sepcial or every active route defined so that I can automate the processing?
> InvoicePOP3IN (which is the name of my In-Channel for POP3)
That's OK.
> Another thing is that I attach the EDI-message to the email but I > could not find out whether this is the correct procedure (e.g. instead > of using the mail body)..
I do not need the edi message.
>> about the automating: >> no, Bots does no scheduling. >> but all OS'es have scheduling tools (eg CRON)
> That is what was my initial thought, too. But is there a python-script > that can be called in order to run one sepcial or every active route > defined so that I can automate the processing?
I've upgraded to 1.6.1 but the error didn't change, it's still
Traceback (most recent call last): File "c:\python26\lib\site-packages \bots\communication.py", line 417, in mime2file topartner=topartner, UnboundLocalError: local variable 'topartner' referenced before assignment
It seems this code before is not running through
for toname,tomail in tos: #all tos-addresses are checked; inly one needs to be authorised. try: topartner = self.mailaddress2idpartner (tomail) break except botslib.AuthorizeError: pass
or perhaps 'tomail' is unitialized?
What does the framework try to do there?
kind regards, markus
On 18 Jan., 17:06, henk-jan ebbers <hjebb...@gmail.com> wrote:
bots uses the email address to identify the partner. I think the error occurs when the email-address is not found. (I think Bots should geven an error, but does not give the right error).
You will have to add a partner with their email address. If you do that, does it run OK?
I tested this some more . this is a bug (will be fixed in 1.6.2). the error is correct but is quite confusing. a workaround is: configure the incoming email address in bots (in partners) (if the email address is known, all goes OK.)