Framework EDI Reference. Methods and Properties
ediDataElement. ImportValue

Imports data from an external file into a data element as a value.

Syntax:

Parameters:

Returns

Returns 1 if the file was imported successfully; otherwise 0 is returned.

Remarks

When data is imported, existing value in the data element is overwritten.

ASC/X12:  If the data type of the element is binary ("B") then the Length of Binary Data (784) element is also updated with the total length of the binary data, if it exists in the same collection. 

Example

Dim oEdiDoc As Fredi.ediDocument
Dim oSchemas As Fredi.ediSchemas
Dim oSchema As Fredi.ediSchema
Dim oDataElement As Fredi.ediDataElement
Dim oDataSegment As Fredi.ediDataSegment

' Create instance of Framework EDI.
Set oEdiDoc = New Fredi.ediDocument

' Disable standard reference library.
Set oSchemas = oEdiDoc.GetSchemas
oSchemas.EnableStandardReference = False

' Load the schema that the EDI file will use.
Set oSchema = oEdiDoc.LoadSchema(App.Path & "\SampleSefX12_280.SEF", Schema_Standard_Exchange_Format)

' Process the EDI file.
oEdiDoc.LoadEdi App.Path & "\SampleEdiX12_280.X12"

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

' Get the data element that is of binary "B" data type and to where the
' the file contents will be imported to.
Set oDataElement = oDataSegment.GetDataElementByPos("\ISA\GS\ST\PWK\EFI\BIN<785>")

' Import a GIF file to the data element.
oDataElement.ImportValue App.Path & "\rhino.gif"

' Data element 784 is automatically updated with the length of the imported data.
Set oDataElement = oDataSegment.GetDataElementByPos("\ISA\GS\ST\PWK\EFI\BIN<784>")

MsgBox "Length of data imported is " & oDataElement.Value

Samples

M_ImportValue.zip