R
: Required. Note: Some PDF implementation guides use a designation of M
(for Mandatory) instead. In these cases, R
is still the appropriate choice.O
: Optional.N
: Not used by this implementation guide.HL
segment identifies dependencies between hierarchically related data segments. For example, there may be hierarchical relationships between components of packing information in an 856 Ship Notice.
HL
segment defines the order at the highest level of the hierarchy. It has four elements.
Element | Name | Description |
---|---|---|
HL-01 | ID Number | Identifies this entry of the HL loop. |
HL-02 | Parent ID Number | The ID Number of the order that this package relates to. |
HL-03 | Level Code | Specifies the type of the entry. In this case, a package. |
HL-04 | Child Code | Specifies whether this entry has children. 1 means yes. |
PRF
segment contains information about the order itself, including the order number ORD02208
.HL
segment repeats when the order becomes a package, and the package itself is described by the segments TD1
and REF
.HL
segment repeats once more when the order contains an item, and the item itself is described by the segments LIN
, SN1
, and PID
.HL
loops to your Stedi guide to define the hierarchical relationships you need for your use case.
You must add HL
loops to your guides one level at a time. For example, you would create three nested HL
segments to capture the following hierarchy.
HL
loop for this scenario:
O
for order.P
for package.N1 Name
loops in each 850
Purchase Order: one for the ship to contact and another for the bill to party. In this case you’d add the Entity Identifier Code as the discriminant for N1 Name
loops. For the bill to
variant, you’d use the BT
qualifier, and for the ship to variant, you’d use the ST
qualifier.
The type of discriminant depends on whether the loop is hierarchical:
HL-03
) on each variant.X
). These have special
rules associated with them. At this step, you should mark them as optional.R0103
means that you must specify at least one of the elements 01
or 03
.
It’s possible to specify more than two elements, so R010304
would mean that you must specify at least one of the elements 01
, 03
, or 04
.
Letter | Name | Condition |
---|---|---|
C | Condition | If the first element is present, then all the other elements must be present. |
E | Exclusive | Only one of the elements may be present. |
L | List conditional | If the first element is present, then at least one of the other elements must be present. |
P | Paired | If one of the elements is present, then all elements must be present. |
R | Required | At least one of the elements must be present. |
[212 Unit Price](https://www.stedi.com/edi/x12/element/212)
has a maximum length of 17. In Guides, this is reduced to 15 by default, since very few use cases legitimately require 17 digits of pricing precision.
If you need additional digits of precision, you can always change a numeric field to a string, which allows you to choose an arbitrary length.
When working with numbers where precision is important, we recommend deserializing to decimal types with the appropriate precision for your business case.
*
~
^
>
:
, <
, and \
.
Choosing delimiters for reading and writing EDI depends on your and your trading partner’s data requirements. Clearly communicate the character restrictions with the business groups that are sending the data. You should also agree on substitution characters when a delimiter appears in the data. For example, if your delimiter is *
and you know incoming data contains mathematical expressions, you could agree to use x
instead of *
for relevant expressions (4x2
instead of 4*2
).
:
or \
instead of >
and <
as delimiters. Likewise, you may want to avoid :
if your text data includes time values in HH:MM:SS
format. We recommend considering the following guidance from the X12 documentation.
The following characters usually occur in data. They should not be used as delimiters:
A-Z
) and lowercase (a-z
) letters0-9
)
)-
)A-Z
) and lowercase (a-z
) letters0-9
)
)-
)