Sample VB .NET source code using FREDI-NET

Sample HIPAA EDI Validation program

	[Run Program]     [Download program]
   'This EDI validation program has two main parts.  The first part is to load all SEF files (implementation
   ' guidelines in Standard Exchange Format) for the EDI file types you will be validating.  The second part is
   ' interrogating the warning object to obtain and then display the errors found after loading the EDI file.  
   ' Framework EDI validates the EDI file by comparing the EDI file against the corresponding SEF file.  Any 
   ' discrepancies found are stored into its warning object.
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        'instantiate edi document
        oEdiDoc.Set(oEdiDoc, New ediDocument)   
        'load edi file as readonly
        oEdiDoc.Option(DocumentOptionIDConstants.OptDocument_ReadOnlyMode) = 1
        'disable internal standard reference library
        oSchemas.Set(oSchemas, oEdiDoc.GetSchemas)  
        oSchemas.EnableStandardReference = False
        'load SEF files only when needed
        oSchemas.Option(SchemasOptionIDConstants.OptSchemas_SetOnDemand) = 1
        oEdiDoc.LoadSchema("D:\Sef\270_X092.SEF", SchemaTypeIDConstants.Schema_Standard_Exchange_Format)
        oEdiDoc.LoadSchema("D:\Sef\271_X092.SEF", SchemaTypeIDConstants.Schema_Standard_Exchange_Format)
        oEdiDoc.LoadSchema("D:\Sef\276_X093.SEF", SchemaTypeIDConstants.Schema_Standard_Exchange_Format)
        oEdiDoc.LoadSchema("D:\Sef\277_X093.SEF", SchemaTypeIDConstants.Schema_Standard_Exchange_Format)
        oEdiDoc.LoadSchema("D:\Sef\820_X061.SEF", SchemaTypeIDConstants.Schema_Standard_Exchange_Format)
        oEdiDoc.LoadSchema("D:\Sef\834_X095.SEF", SchemaTypeIDConstants.Schema_Standard_Exchange_Format)
        oEdiDoc.LoadSchema("D:\Sef\835_X091.SEF", SchemaTypeIDConstants.Schema_Standard_Exchange_Format)
        oEdiDoc.LoadSchema("D:\Sef\837_X096.SEF", SchemaTypeIDConstants.Schema_Standard_Exchange_Format)
        oEdiDoc.LoadSchema("D:\Sef\837_X097.SEF", SchemaTypeIDConstants.Schema_Standard_Exchange_Format)
        oEdiDoc.LoadSchema("D:\Sef\837_X098.SEF", SchemaTypeIDConstants.Schema_Standard_Exchange_Format)
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sEdiString As String
        Dim nErrCount As Integer
        Dim i As Integer
        sEdiString = Trim(txtEdiString.Text)
        If Len(Trim(sEdiString)) > 0 And Len(Trim(sEdiString)) < 10000 Then
            'load edi string
            'instantiate warnings collection object
            oWarnings.Set(oWarnings, oEdiDoc.GetWarnings)   
            'get count of error found
            nErrCount = oWarnings.Count
            lblMessage.Text = "There were " + Str(nErrCount) + " errors found."
            'display error messages
            For i = 1 To nErrCount
                'instantiate a warning object from the warnings collection
                oWarning.Set(oWarning, oWarnings.Warning(i))    
                lstErrorList.Items.Add(oWarning.LoopId + " " + oWarning.SegmentId + " " + oWarning.Description)
            lblMessage.Text = "Program only accepts short HIPAA EDI files (less than 10K characters)"
        End If
    End Sub


EDIdEv - EDI Development