Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to specify a certain set of segments? #15

Closed
Shpigford opened this issue Jun 18, 2013 · 1 comment
Closed

How to specify a certain set of segments? #15

Shpigford opened this issue Jun 18, 2013 · 1 comment

Comments

@Shpigford
Copy link

Here's a typical transaction set:

ST|214|000056421~
B10|0|0|UPSN~
L11|QVD|TN|O4~
L11|1Z75A3T3YT10727583|2I~
L11|68600 TL 182555|CR|SHPREF1/~
L11|68600 TL 182555|CR|PKGREF1/~
N1|SH|NA|25|75A3T3~
N1|BT||25|75A3T3|01~
LX|1~
AT7|X2|A2|||20130612|213727|LT~
L11|AH-THE ADDRESS HAS BEEN CORREC|RRS|. THE DELIVERY HAS BEEN RESCHE~
L11|DS-THE ADDRESS LABEL IS MISSIN|REC|R ILLEGIBLE~
MAN|CP|E1|ONTARIO HUB|CP|CA|US~
CD3|||E1~
CD3|||R4~
N1|UP|ABE LINCOLN~
N3|123 ANYWHERE AVE~
N4|SOMEWHERE|NY|33332|US~
SE|19|000056421~

What I'm ultimately trying to pull is that set of N1, N3 and N4 towards then end of the set.

But, there will occasionally be an additional set of those under the first occurrence of N1 (and before AT7).

So how would I differentiate those and select only those segments before AT7 or only those towards the end?

Does that make sense?

@kputnam
Copy link
Owner

kputnam commented Jun 18, 2013

From the sample file you provided earlier, it looks like these segments aren't specified in the grammar so you'll have a difficult time accessing them (you can play with #find! but I wouldn't suggest it). Here's the output of bin/edi-pp (after changing it to use Config.contrib):

            LoopVal[0205](
              SegmentVal[AT7: Shipment Status Detail](
                ID.empty[E1650: Shipment Status Code],
                ID.empty[E1651: Shipment Status or Appointment Reason Code],
                ID.value[E1652: Shipment Appointment Status Code](AB: Delivery Appointment Date and/or Time),
                ID.value[E1651: Shipment Status or Appointment Reason Code](BG: Other),
                DT.value[ E373: Date](2013-06-19),
                TM.value[ E337: Time](23:59:0.0),
                ID.value[ E623: Time Code](LT: Local Time (Preferred Usage - Explain in detail)))),
            SegmentVal[L11: Business Instructions and Reference Number](
              AN.value[ E127: Reference Identification](DL-RETURNED TO SHIPPER),
              ID.value[ E128: Reference Identification Qualifier](RRS: Reconciliation Report Section Identification Code),
              AN.empty[ E352: Description]),
            SegmentVal[L11: Business Instructions and Reference Number](
              AN.value[ E127: Reference Identification](49-THE CUSTOMER WAS NOT AVAILA),
              ID.value[ E128: Reference Identification Qualifier](REC: Related Case),
              AN.value[ E352: Description]( ON 3RD ATTEMPT)),
            InvalidSegmentVal[MAN],
            InvalidSegmentVal[CD3],
            InvalidSegmentVal[CD3],
            InvalidSegmentVal[N1],
            InvalidSegmentVal[N3],
            InvalidSegmentVal[N4]),

How you seek to this N1 will ultimately depend on the changes you make to the grammar. If MAN is a sibling loop to 0200 and N1 is a child loop of MAN, you could jump directly from ST to MAN, and the from MAN to N1. You'll need some documentation from your trading partner to be able to construct the grammar, though.

@kputnam kputnam closed this as completed Jul 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants