ActiveX - Opening Databases
Opening a database and then drawing a Daisy Chart was described in Drawing a Daisy Chart.
The actual opening of databases and the various techniques that can be used are described in detail here.
Three ways of opening databases and loading the data into the internal database of Daisy :-
The LoadDatabase ... methods are designed for loading databases, which have either been chosen or generated by the calling program.
Several separate methods each of which handles a specific database type can be used :-
These methods are very comprehensive with several parameters, which determine how the database will be loaded.
The code below shows the loading of an Excel worksheet.
Dim wrkError as String
Dim wrkPath as String
...
wrkPath = ...
if (Daisy.LoadDatabaseExcel(wrkPath, "Sheet1", wrkError, _
dsxXLField9Data11, 2, 25, 1000) = False) Then
Daisy.MessageError wrkError
Exit Sub
End If
...
Note :-
The MenuOpen ... methods directly action the various methods that call dialogs to select and load databases.
Several separate methods each of which handles a specific database type can be used :-
The code below shows the loading of a CSV file.
...
Daisy.DirectoryDatabase = ...
Daisy.MenuOpenCSV
if (Daisy.TestDatabaseOpen = False) Then
Daisy.MessageInfo "No database opened!"
Exit Sub
End If
...
Note :-
In addition two commands, MenuOpenExamples and MenuOpenShowcase can be used to open the examples and the showcase respectively.
In some applications, it may be necessary to enter the database into Daisy in a much more direct manner.
Suppose you have a complex scientific instrument, which generates a series of results and the set are to be analysed. The results might be held as a two-dimensional array in the controlling program.
These could be saved to disc and then Daisy could load the file, but there is a more direct and perhaps in many cases simpler way, using direct methods.
The code below shows the loading of an array, Results, of 1000 records into Daisy.
Dim Names(1 to 10) As String
Dim Values(1 to 10) as String
Dim wrkError as String
Dim kk as Long
Dim kkk as Long
...
If (Daisy.LoadDatabaseStart(wrkError) = False) Then
Daisy.Message wrkError
Exit Sub
End If
Names(1) = "Date"
Names(2) = "Time"
Names(3) = "Value"
Names(4) = "Comment"
Names(5) = "X1"
Names(6) = "Y1"
If (Daisy.AddDatabaseFields(6, Names(), wrkError) = False) Then
Daisy.MessageError wrkError
Exit Sub
End If
For kk = 1 to 1000
For kkk = 1 to 6
Values(kkk) = Results(kk, kkk)
Next kkk
If (Daisy.AddDatabaseRecord(Values(), wrkError = False) Then
Daisy.Message wrkError
Exit Sub
End If
Next kk
If (Daisy.LoadDatabaseFinish("Results", wrkError) = False) Then
Daisy.Message wrkError
Exit Sub
End If
Daisy.ShowDaisy
...
Note :-