[EDI-L Mailing List Archive Home] [Message List] [Reply To This Message]

Re: Gentran NT: Skipping Segment occurances in a group

From: "svg1970" <svg1970@...>
Date: Thu Jan 15, 2004  7:42 pm
Subject: Re: Gentran NT: Skipping Segment occurances in a group
I just tried after moving the 'On End' extended rule on
N1 group to 'On Begin'.

And the result: It does not write a HDR1 record at all.
Output contains

line 1: HDR2 xxxxxxxxxxxxxxxxxxxxx xxx xxx
line 2: DTL xxxxxxxxxxxxxxxx xxx x xx x xxx

I guess, the translator does not recognize the second occurance
of the N1 segment as part of the N1 group / loop. Right? Why?
Still scratching .....


--- In "svg1970" <svg1970@y...> wrote:
> Thanks Mike and Peter.
>
> I, in fact, was trying almost identical to what Mike suggested, but
it
> was not working somehow.
>
> The structure I have is
> ISA
> GS
> ST
> BPT
> DTM upto 10
> TMP1_DTM
> N1_group upto 5
> N1
> TMP_N1 --------------------------> HDR1
> GRP_2 upto 999999
> aaa -----------------------------> HDR2
> bbb multiple -----------------------> DTL
>
> HDR1 should occur only once per ST or BPT. Under that(HDR1), comes
> HDR2 + multiple DTLs, HDR2 + multiple DTLs .....
>
> If there are more ST / BPTs, this repeats.
>
> In the test data I have there is only one ST, and data for one HDR2
> and one DTL. In the N1 group, there are two occurrences of N1
> segments,
> first one with N101='DB', second one with N101='SU'. N101='SU' is
> what I want to map to the output. For some silly reason (which I
have
> not been able to figure out so far) the output looks
>
> line 1: HDR2 xxxxxxxxxxxxxxxxxxxxx xxx xxx
> line 2: DTL xxxxxxxxxxxxxxxx xxx x xx x xxx
> line 3: HDR xxxxxx xxx xx xxx xxx xxx
>
> All field mapping are correct. But the first HDR record is not
there
> in the first line 1.
> It seems the translator starts reading the N1 group, sees the N1
with
> N101='DB'
> and correctly decides not to map
> any of the stuff and proceeds further....but, instead of reading the
> next N1 (with N101='SU'), it goes to the next level and creates HDR2
> and DTL. And, after that somehow, comes back to the second N1 (with
> N101='SU') and decides to create a HDR record.
>
> If I swap the N1 segments (that is, move N1 with N101='SU' before
> the N1 with N101='DB'), there is no problem, everything is fine and
> cool. All records, and fields within, are mapped correctly and in
> the right sequence.
>
> So, here I am, scratching my head and with a dumb look pasted on my
> otherwise intelligent (!!) face.
>
> By the way, I have marked all segments within all loops in the map
> as 'normal' , not 'loop start' or 'loop end'. Just in case that
> mattered.
>
>
>
> Mike Monica wrote:
> --------------------------------------------------------------------
--
> create a temp segment, say TEMPN1. create the elements you would
like
> mapped
> under this segment, i.e. N101 N102 N103 N104.




>
> Create an On End Extended rule on the N1 Group:
>
> if #0098 = "SU" then
> $TEMPN1.N101=#0098;
> so on and so forth.
>
> Create the links to the HDR1 from the temp segment.
>
> The only time the mapping from the temp segment to the HDR1 will
> occur is if
> there is data in the temp segments. The only way the temp segments
get
> populated is if the N101 equals SU.
>
> If there are multiple occurances of an N101 with SU, set a flag as
> well. In pre
> session rules set a sring variable (length of 1) called "N1Flag" to
> N. Your
> logic in the extended rule would look like this:
> if #0098 = "SU" & N1Flag="N" then
> N1Flag="Y"
> $TEMPN1.N101=#0098;
> so on and so forth.
>
> Mike Monica




 
EDI to XML Mapping for EDIFACT/X12 Convert EDIFACT/X12 Schemas to XML Schema Legacy Data Conversion Tools Access Relational Data as XML Visual XSLT and XQuery Mapping Tools Simplify EDI Data Integration with Stylus Studio XML Enterprise Suite - Free Download!
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.