Framework EDI Reference. Methods and Properties
ediSchema. TriggerSegmentReference

Reference a data segment definition in the ASC/X12 Transaction Set or UN/EDIFACT Message table based on the value of the data element that is read from or assigned to the subject document.

Syntax:

Parameters:

Returns:

Returns 1 if successful; otherwise 0 if unsuccessful.

Remarks:

This method allows an alternate segment definition to be reference if a specific value is encountered from or assigned to the document.  For example, consider the following segment definitions in ASC/X12 Transaction Set 276 at position 100:

There are 2 segment definitions for data segment at position 100, the first is defined to be mandatory and the second is optional.  If the following conditions are to be implemented:

then TriggerSegmentReference is stated as follows:

Dim oSef As Fredi.ediSchema

:

oSef.TriggerSegmentReference "276", 2, "HL;TRN", "REF", 1, 0, "1K", 1, "2200D"
oSef.TriggerSegmentReference "276", 2, "HL;TRN", "REF", 1, 0, "BLT", 2, "2200D"

The alternate segment definitions can be included in the SEF file under the .PRIVATE EDIdEv section so that the definitions do not have to be written into your program.  The syntax of the definitions in the SEF file have the same order of parameters as the TriggerSegmentReference method, separated by the forward-slash. e.g. .SEGMENT1 276/2/HL;TRN/REF/1/0/1K/1/2200D.

Each alternate segment definitions must have the following properties identical to the first definition:

If trigger segment definitions are stated both in the SEF file and in the program, the trigger segment definitions in the program overrides the definitions in the SEF file.

Example:

oSef.TriggerSegmentReference "276", 2, "HL;TRN", "REF", 1, 0, "1K", 1, "2200D"
oSef.TriggerSegmentReference "276", 2, "HL;TRN", "REF", 1, 0, "BLT", 2, "2200D"
oSef.TriggerSegmentReference "276", 2, "HL;TRN", "REF", 1, 0, "EA", 3, "2200D"
oSef.TriggerSegmentReference "276", 2, "HL;TRN", "REF", 1, 0, "1K", 1, "2200E"
oSef.TriggerSegmentReference "276", 2, "HL;TRN", "REF", 1, 0, "BLT", 2, "2200E"
oSef.TriggerSegmentReference "276", 2, "HL;TRN", "REF", 1, 0, "EA", 3, "2200E"
Set oAck = oEdiDoc.GetAcknowledgment
oAck.EnableFunctionalAcknowledgment = True
oAck.MapDataElementLevelError 13209, 5
oEdiDoc.LoadEdi sEdiFile
oAck.Save spath & sAckfile

The equivalent of the above trigger segment definition in a SEF file:

.SEGMENT1 276/2/HL;TRN/REF/1/0/1K/1/2200D
.SEGMENT2 276/2/HL;TRN/REF/1/0/BLT/2/2200D
.SEGMENT3 276/2/HL;TRN/REF/1/0/EA/3/2200D
.SEGMENT4 276/2/HL;TRN/REF/1/0/1K/1/2200E
.SEGMENT5 276/2/HL;TRN/REF/1/0/BLT/2/2200E
.SEGMENT6 276/2/HL;TRN/REF/1/0/EA/3/2200E