Framework EDI Reference. Methods and Properties
ediDataSegment. DataElementFileValue

Gets or set the contents of a file to the value of a Data Element in the Data Segment.

Syntax:

Parameters:

Remarks:

When assigning a file object to the data element, the data stored to the data  element is the contents of the physical file of the ediFile object.  When retrieving a value as a file object, the value of the data element is stored to a temporary file, and the ediFile object of the temporary file is returned.  The temporary file is deleted when the instance of the object is destroyed.

NOTE: If the data element has no value, this property will return an empty object or NULL.

Example 1: Getting the value

Dim oDataSegment As Fredi.ediDataSegment
Dim oFile As Fredi.ediFile

....

' Get first data segment in document.
Set oDataSegment = oEdiDoc.FirstDataSegment

' Get the BEG data segment.
Set oDataSegment = oDataSegment.GetDataSegmentByPos("\ISA\GS\ST\BEG")

' Get the file object containing the data element value.
Set oFile = oDataSegment.DataElementFileValue(5)

' Get the value from the file object.
MsgBox "Element Value: " & oFile.GetStringContent(EncodeType_Binary)

Example 2: Setting the value

Dim oDataSegment As Fredi.ediDataSegment
Dim oFile As Fredi.ediFile
Dim oFileSystem As Fredi.ediFileSystem

....

' Get file system.
Set oFileSystem = oEdiDoc.GetFileSystem

....

' Get first data segment in document.
Set oDataSegment = oEdiDoc.FirstDataSegment

' Get the BEG data segment.
Set oDataSegment = oDataSegment.GetDataSegmentByPos("\ISA\GS\ST\BEG")

' Set file object with file containing new data element value.
Set oFile = oFileSystem.GetFile(App.Path & "\FileValue.txt")

' Set the data element value from the file object.
Set oDataSegment.DataElementFileValue(5) = oFile

' Show new value of data element.
MsgBox "Element Value: " & oDataSegment.DataElementValueByPos("\ISA\GS\ST\BEG<373>")

Sample

P_DataElementFileValue.zip