Creates a Data Segment in the UN/EDIFACT Message or ASC/X12 Transaction Set.
Syntax:
Parameters:
Returns
Returns object of type FREDI.ediDataSegment if the operation is successful; otherwise returns NULL or empty object if the operation fails.
Remarks
The CreateDataSegment method adds a data segment into the transaction set specified by the hierarchical syntax. The hierarchical syntax must not conflict with the methods restriction of being able to create segments only within the transaction set, otherwise an error will occur. For example, to add a BEG data segment, the hierarchy string should be “BEG”, and not "\BEG". It should not have a backslash before it otherwise it would force the data segment to be added into the root of the document tree, in the same level as the "ISA" segment, which would be incorrect. However, the following syntax “\ISA\GS\ST\BEG” is valid, which will add the "BEG" data segment into the transaction set based on the root of the document.
Example
Set oTransactionSet = oGroup.CreateTransactionSet(“810”)
Set oSegment = oTransactionset.GetDataSegmentHeader
oSegment.DataElementValue("329") = "000000001"
'Creates the BIG segment, then populates its elements
Set oSegment = oTransactionset.CreateDataSegment("BIG")
oSegment.DataElementValue(1) = Format(txtShippedDate.Text, "YYYYMMDD")
oSegment.DataElementValue(2) = txtInvoiceNo.Text
oSegment.DataElementValue(4) = txtPONumber.Text