Framework EDI Reference. Methods and Properties
ediFile. IsUnEdifact

Indicates if the file is an UN/EDIFACT EDI document.

Syntax:

Remarks

To quickly determine if the file is a UN/EDIFACT document, FREDI does the following:

  1. Attempts to detect for a UNA service segment.  Then a search is made for the interchange header UNB.  
  2. A search is made for the next valid control segment from the UNB interchange header, and if found, determines the existence of data elements UNB segment up to the next control segment.  If data elements exist, then the file is determined to be a UN/EDIFACT document.

In the example below, only the shaded portion has been verified to determine if the file is a UN/EDIFACT file.

 

Example

Dim oEdiDoc As Fredi.ediDocument
Dim oFileSystem As Fredi.ediFileSystem
Dim oFile As Fredi.ediFile

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

' Get file system object.
Set oFileSystem = oEdiDoc.GetFileSystem

' Get file object.
Set oFile = oFileSystem.GetFile(App.Path & "\TestFile_ORDERS.edi")

If oFile.IsUnEdifact Then

MsgBox oFile.FileName & " is a UN/EDIFACT document"
Else
MsgBox oFile.FileName & " is NOT a UN/EDIFACT document"
End If

Samples