[Mail list Bots EDI software] X12 translation for a newbie..HELP!!

331 views
Skip to first unread message

Jack

unread,
May 13, 2010, 7:20:27 PM5/13/10
to Bots Open Source EDI Translator
Hi, folks! I am a babe-in-the-woods newbie to Bots and Python, and I'm
having some real difficulty in processing a X12 to CSV translation for
a 271 transaction. I get the message:

InMessageParseError: line:1 pos:1; record:"ISA" not in grammar; looked
in grammar until mandatory record: "[['ST']]"

when processing the file, which has one ISA and IEA segment at each
end. I have the X12.py file present in the grammar folder, and I'm
using the 271004010.py grammer in the translation, but Bots is not
recognizing the ISA segment. What am I doing wrong? Do I need to
import the x12.py code into the 271 message grammar, or is there
something else I need to do for Bots to recognize the segment? Any
help would be greatly appreciated!

henk-jan ebbers

unread,
May 13, 2010, 7:26:37 PM5/13/10
to bots...@googlegroups.com
Hi Jack,


what probably is the problem is that you SHOULD have messagetype x12 in
the route.
probably you used something like 271004010 for messagetyep.

(please take a good look at the plugins. these spell it all out. just
follow the examples.)


kind regards,
henk-jan

Jack

unread,
May 19, 2010, 12:24:15 PM5/19/10
to Bots Open Source EDI Translator
Thanks for your help, Henk-Jan. I resolved the ISA problem, but I have
a further question(maybe I'm just being dense about this, but..). I
have an x12 message to read, that has multiple nested segments in a
hierarchy, and a parent segment can have more than 1 entry of a child
segment under it(i.e. more than one 'NM1' segment under a 'HL'
segment). I need to send specific fields to a CSV file from this data.
In order to find a field in a group of records two levels down in a
segment, do I need to perform multiple 'getloop' statements to go
through each level of records, or can I go directly to the field with
one 'get' statement? I'm just having a lot of difficulty in
understanding how the 'get' and 'getloop' statements should function
against a hierarchal structure like the x12/271 message. Any help
would be greatly appreciated!

henk-jan ebbers

unread,
May 19, 2010, 1:23:24 PM5/19/10
to bots...@googlegroups.com
the arguments used in get and getloop are called mpath.
a mpath identifies the place in the message; use segments and code
values to identify
get({'BOTSID': 'XX', XX01:'NO'}{'BOTSID': 'YY','YY01':None}
(get content of YY01 field in YY segment under a XX segment where XX01
has value 'NO'

(so: get() can fetch an item as 'deep' as you want, using segment ID's
but also other codes to filter)

I use getloop() only for things like lines in an invoice: I want to
process all lines (not just fetch one line).

in getloop() you can also be used like:
getloop({'BOTSID': 'ZZ', ZZ01:'NO'}{'BOTSID': 'YY','YY01':'15'}
returns YY segments (where YY01 has value 15 nested under ZZ with ZZ01
is 'NO'


hope this helps,
henk-jan

henk-jan ebbers

unread,
May 20, 2010, 5:49:28 AM5/20/10
to bots...@googlegroups.com
Jack,

thinking about your question some more info:

the 271 message with HL structures in health care is quite complicated.
(yes, health care.....)

You indicate you are starting with EDI: weel, you are starting with a
one of the more complicated messages.
IMO: this can be confusing, as you get a lot of new information. The
structure of this message takes some time to 'settle down in your mind'.
At least that is my experience.
so be aware that you have a tough start (most people start with a 'easy'
message like orders/850).

Time ago I took a look at the HL structure (I know this type of
structure from some edifact messages).
Bots can handle this very well.

Most important issue here is to set up a good inhouse-format. And a good
format would be: as convenient for your application as can be: try to
keep the CSV import as simple as possible.
When setting up the mapping: think of it as filling the CSV file,
fetching from the 271
(the opposite would be: walk over the 271, try to generate CSV records;
IMHO a confusing way).

Jack

unread,
May 20, 2010, 11:29:33 AM5/20/10
to Bots Open Source EDI Translator
Thank you for your insight and further info, Henk-Jan. I ought to
write up a manual page for get(), getloop(), put(), putloop() based on
the info you've given me already! Your info does help A LOT with
understanding how Bots works in accessing information.

My problem was in thinking about the tree as something where I had to
read at a specific level to get to the next level of data, instead of
providing a path to the specific piece of info I need in one
statement. I agree with you that the 271 document is a hard place to
start, but it's the document I have to read for the project on which
I'm working. This info should simplify what I'm trying to do
immensely. Again, thank you for your efforts and consideration!

Jack
Reply all
Reply to author
Forward
0 new messages