Class Name: |
HL7PlusFolderAnalyzer |
HL7+ Category: |
Restricted (Accessed through the HL7PlusController object) |
Description: |
Folder Poller object class for HL7 data files |
*All example code is in Visual Basic.Net 'Where MyController is a HL7PlusController object
Dim oAnalyzer As HL7PlusFolderAnalyzer oAnalyzer = MyController.NewHL7PlusFolderAnalyzer("C:\Hl7Data") If IsNothing(oAnalyzer) Then 'An Error occurred MessageBox.Show(MyController.LastError, "Error") Return End If
'A data table to hold our analysis results Dim dtResult As DataTable
With oAnalyzer 'I want to look for 2 different file extensions .AddFileExtension("hl7") .AddFileExtension("txt") 'I don't want to see any 0 byte files .IgnoreZeroByteFiles = True 'This is a shared folder so I want to make sure that I 'don't step on a file while it's being copied into my folder. .MinimumFileAge = 2 'Files must be at least 2 seconds old to qualify dtResult = .AnalyzeFolder() If .IsError Then MessageBox.Show(.LastError, "Analysis Error") Return End If End With 'dtResult is now a data table with 5 columns '--1) FILETITLE (String) '--2) FILEEXTENSION (String) '--3) FILEDATE (Date) '--4) FILESIZE (Long) '--5) PROCESSED (Boolean) Will be False '--The Default View sort will be on FILEDATE AND FILETITLE '--There will be NO NULL FIELD VALUES If dtResult.Rows.Count = 0 Then MessageBox.Show(oAnalyzer.FolderPath & " Contains no matching text files") Return End If Dim dv As DataView = dtResult.DefaultView Dim i As Integer Dim fld As String = oAnalyzer.FolderPath 'This WILL have a trailing backslash For i = 0 To dv.Count - 1 Dim s As String = fld & dv(i)("FILETITLE") '....Code for each file '....Code for each file '....Code for each file Next
|
|
|
|
This object class uses our standard HL7PlusException Class interface for error handling wherever possible.
See the HL7PlusException Implementation Reference
|