Data Viewer

The data collected in the database can by displayed and analyzed using the Data Viewer. The Data Viewer includes 4 different types of data windows:

  1. Data table, where the values are presented in an arranged table form.
  2. Data Histogram with distribution of measurement values.
  3. Scatter plot that shows distribution of any two measurements against each other.
  4. Data Graph that displays the data collected in the Data Viewer in graphic form.

The Data Viewer provides tools to collect data from a database node, display it in various table and graphic forms, analyze it using different data windows including possibility of sorting, selecting and querying and to export the data. The data can be exported into a file, Excel or to the Report Generator.

The Data Viewer is an AddIn for the Application that exposes the DataViewer object to provide a specific data handling support for the Application.  The data collected from the active database node is stored in the data pool, which can be accessed using DataViewer.DataColumns object.

Exampe 1. Select data source.

Sub PrintDataTableByCells()
    Dim dvc As McDataColumns

    Dim col As McDataColumn
    Dim DataStr As String
    Dim i%, j%

    Set dvc = DataViewer.DataColumns
    Debug.Print "Number of columns="; dvc.Count
    Debug.Print "Number of rows="; dvc.Rows 


    'print data table

    For i = -1 To dvc.Rows - 1
        DataStr = CStr(i + 1) & ";"

        For Each col In dvc

           If i = -1 Then

              'print data colum names, local 

              DataStr = DataStr & col.Caption & ";"
           Else
              DataStr = DataStr & col(i) & ";"
           End If
        Next
        Debug.Print DataStr
    Next i


    'print statistics

    For i = 0 To UBound(dvc.StatTitles)
        DataStr = dvc.StatTitles(i) & ";"
        For j = 0 To dvc.Count - 1 
           Set col = dvc(j)
           DataStr = DataStr & col.ItemStats(i) & ";"
        Next j
        Debug.Print DataStr
    Next i

End Sub

Sub CopyAllDataGraphsToMsWord() 
     Dim InstColl As Collection, i As Integer, j As Integer 
     'get MsWord 

     Dim msWord As Word.Application
     Set msWord = CreateObject("Word.Application")
     If Not msWord Is Nothing Then
          With msWord 
               .Visible = True
               .Documents.Add DocumentType:=wdNewBlankDocument
          End With
     End If
     Dim DataWindows 
     DataWindows = Array("DataHistogram", "DataGraph", "ScatterPlot")
     For j = 0 To UBound(DataWindows)
       Set InstColl = Application.DataViewer.GetListOfDataWindows(DataWindows(j)) 

      'copy graphs of all open data windows to MsWord 
       For i = 1 To InstColl.Count 
          'copy graph to clipboard 

           Application.Dialogs(DataWindows(j), InstColl(i)).ActivePage.Control.CopyGraphToClipboard 

           'paste graph to open word document 

           If Not msWord Is Nothing Then
               With msWord
                  .Selection.Paste 
                  .Selection.TypeParagraph
               End With
           End If
      Next i
    Next j
End Sub

For more information see Mc­Data­Viewer, McDataColumns, McDataColumn.

Reporter

The reporter is a fairly simple object used to control the report generation feature of IQstudio. Its automation API will be the most useful to automate the creation of reports like in the following example where the default report for the active image is printed.

' Print the default report, let the user select the destination

Reporter.PrintReport mcrtDefault, , ActiveImage