nextmessage in DB communicationscript

128 views
Skip to first unread message

Hans

unread,
Jul 8, 2021, 8:49:04 AM7/8/21
to Bots Open Source EDI Translator
Hi All,

I woud like to fetch all ORDRSP's in 1 query from our ERP Database for different customers and process these to be send all different ways.
Is there a way in the DB communicationscript, like 'nextmessage' in a grammar, to split up the different ORDRSP's i get from the DB?
Or maybe to run a query which get's 1 ORDRSP at a time in a loop until i got them all and then processes the messages though the rest of the route?

Best regards, 
Hans

Eppye Bots

unread,
Jul 9, 2021, 4:38:33 AM7/9/21
to 'Chuck Turco' via Bots Open Source EDI Translator
fo DB communicationscript output is a (list of) python objects.
each object if fed to translation.as there is no grammar, there is no query to determine frompartner/topartner.

if you retrieve eg json or xml from database it would be possible to save as json/xml, and use queries to determine from.to-partner.

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/221e78c0-6db7-4dc2-a827-26c2c89caa20n%40googlegroups.com.

Hans

unread,
Jul 14, 2021, 8:48:01 AM7/14/21
to Bots Open Source EDI Translator
Hi Henk-Jan,

I found a way in the DB communicationscript to create a CSV layout the way i'm used to process the ORDRSP's.
However, instead of writing it to a temp csv file and pick that file up with a 2nd route, i was wondering if it's possible to create a new inmessage like i'm doing with the response i get from an outgoing api call.

ta_resp = ta_from.copyta(status=FILEIN,
                         editype='csv',
                         frompartner='partner',
                         messagetype='ordrsp_csv')

I tried, but i didn't get it working. if it would be possible, i've added the communicationscript, what am i doing wrong?

Best regards,
Hans
Op vrijdag 9 juli 2021 om 10:38:33 UTC+2 schreef eppye:
db2csv.py

Eppye Bots

unread,
Jul 14, 2021, 9:00:52 AM7/14/21
to 'Chuck Turco' via Bots Open Source EDI Translator
you will have to have grammar for csv, mention editype and messagetype in route, and translate.
this should just work.

kind regards, Henk-Jan Ebbers


Hans

unread,
Jul 14, 2021, 11:09:51 AM7/14/21
to Bots Open Source EDI Translator
I've created a grammar, translation and route to proces the CSV file, but the new message isn't recognized by bots yet.
I think i messed up the "ta_to = botslib.NewTransaction" part, so bots doesn't know there is a second new incomming message.
The CSV file is saved in the \botssys\data\ folder, but doesn't show up in the route details for further processing.

any ideas?
Op woensdag 14 juli 2021 om 15:00:52 UTC+2 schreef eppye:

Hans

unread,
Jul 15, 2021, 10:20:58 AM7/15/21
to Bots Open Source EDI Translator
ok, 
Instead of trying create a second inmessage in the DB communicationscript, i've eddited the result the DB incomming channel sends to the grammar trough a routescript.
The result is in CSV instead of 'article', so alltough i'm calling a DB channel, the fromeditype is read in CSV grammar and no need for a composite route.
probebly not the prettiest way of solving this issue, but it works :)
Op woensdag 14 juli 2021 om 17:09:51 UTC+2 schreef Hans:

Eppye Bots

unread,
Jul 15, 2021, 12:47:00 PM7/15/21
to 'Chuck Turco' via Bots Open Source EDI Translator
good that it works!
why did you need a route-script ?

kind regards, Henk-Jan Ebbers


Hans

unread,
Jul 16, 2021, 3:48:54 AM7/16/21
to Bots Open Source EDI Translator
Hi Henk-Jan,

Allthough the content of 'articles' is change to CSV, when returning the result from comm.script to the grammar, bots still adds:    S' *content* ' p1 .
in the routescript i stripped the extra characters so it's just the CSV again.
Also in the content the line ends returned als plain text, so i had to do a content.split
Op donderdag 15 juli 2021 om 18:47:00 UTC+2 schreef eppye:

Eppye Bots

unread,
Jul 16, 2021, 8:08:45 AM7/16/21
to 'Chuck Turco' via Bots Open Source EDI Translator
not sure what you mean?
add? to what?


kind regards, Henk-Jan Ebbers


Hans

unread,
Jul 22, 2021, 11:26:23 AM7/22/21
to Bots Open Source EDI Translator
Hi Henk-Jan,

@ the end of the DB communicationscript the content of the csv is returned
      return output.getvalue()

for example:
HEA;a;b;c;d
LIN;1;2;3;4
LIN;2;3;1;4

however the grammar recieves the following content:

S'
HEA;a;b;c;d
LIN;1;2;3;4
LIN;2;3;1;4'
p1
.

With a routescript and 'postincommunication' i strip the extra characters from the content before it's presented to the grammar.
Op vrijdag 16 juli 2021 om 14:08:45 UTC+2 schreef eppye:

Eppye Bots

unread,
Jul 23, 2021, 7:20:07 AM7/23/21
to 'Chuck Turco' via Bots Open Source EDI Translator
that is a internal python thing (google for python pickle)
do not use it like that. (eg if certain characters are in it it will be different.


kind regards, Henk-Jan Ebbers


Reply all
Reply to author
Forward
0 new messages