Closed manuel-neuhauser-hs closed 1 year ago
@manuel-neuhauser-hs good question.
Yes, you're not able to because omniparser is designed as a streaming parser. As it reads in and builds the hierarchical tree (in IDR), when it encounters and finishes ingesting and transforming a segment marked with is_target: true
, it will return to the caller's transform.Read()
call. In your case, the later segments GE
IEA
haven't even been read it yet. There is no magic about it. And currently we don't have any way of out of sequence read, or something like 2-pass reading.
One potential solution, depending on your input EDI file size, is to:
IEA
under ISA
, similarly put GE
as a child segment of GS
and SE
as child of ST
. That in some way makes sense, because IEA
, GE
, SE
are indeed the respective closing segs for ISA
, GS
, ST
.is_target: true
onto ISA
. This way, you basically read the entire EDI file in one block, all info will be available.array
under transform_declarations
. Somewhat resembles transforms done here: https://github.com/jf-tech/omniparser/blob/master/extensions/omniv21/samples/edi/2_ups_edi_210.schema.json#L200Let me know if you have additional questions.
(P.S. a bit more in depth, as omniparser "streams" parsing in the EDI file, builds IDR and performs transforms on is_target: true
segment/segment_group, once it's done returning to caller, and upon the next transform.Read()
call, it will delete/remove the current is_target
segment from the IDR tree. So it will have all the parent segments of is_target
seg in memory/IDR, but it will never have more than 1 is_target: true
segment in IDR/memory; and it will never, as I explained above, have any segments beyond the current reading cursor).
Thanks for the insight. I'll try the proposed solution.
For an EDI file with a nested segment set to
is_target: true
, I'm unable to access higher level segments beyond direct ancestors.For example, using xpath to navigate up the hierarchy to the
functional_groups
segment and then down to theGE
segment returns no values yields no result.Simplified Segment Declaration
Example FINAL_OUTPUT Configuration
Example Output
Note that
ge_footer
andiea_footer
are not present.Command
Files
edi834.txt 834-schema.json.txt
Is there an issue with my schema file, or is accessing these values not supported? Thanks in advance.