DIAdem Help

Content Type
Programming Language
Current manual

How DataPlugins Work

How DataPlugins Work

DIAdem accesses data files with USI which is short for Universal Storage Interface. USI reads file data with specific DataPlugins generally developed by NI. Use DataPlugins to integrate your own file format into DIAdem.

A DataPlugin is based on a VBS script. This script must contain a procedure called ReadStore with the parameter File. USI calls the ReadStore procedure when a user loads a file for which the DataPlugin was written. The File parameter references the file you want to load. The script makes the information you read from the file available to USI. USI then forwards this information to DIAdem.

Creating DataPlugins

To create a DataPlugin, you must be familiar with the file structure. Therefore, you need a detailed description of the data format before you can program the DataPlugin.

When you have this information, you can select Settings»Extensions»DataPlugins in DIAdem NAVIGATOR or in DIAdem SCRIPT, to create a DataPlugin. In the dialog box New DataPlugin you specify the name of the DataPlugin and the filename extensions of the files which DIAdem can load with the Data Plugin.

 You then program the script in a script editor.

Programming a DataPlugin

Open the generated script in the Script Editor to view the predefined example procedure ReadStore.

Specify how to interpret the contents of the File file in the ReadStore procedure. The DataPlugin interface has functions that read the file in any order you want. You can also use the DataPlugin interface to create data model instances (Root, ChannelGroup and Channel) and fill the instances with the data that has been read.

Start programming and delete the predefined contents of the ReadStore procedure so that only the following rows remain.

Option Explicit
Sub ReadStore(File)
End Sub

The ReadStore Procedure

The default parameter of the ReadStore procedure is File. The File parameter contains the reference to the open file selected in the DataFinder.

Depending on which File Reader you selected in the New DataPlugin dialog box, the procedure might have one of the following parameters:

File Reference to the file to be loaded if you selected ASCII/Binary.
Use the File object in the script to access information such as name, origin, and size of single values, text, or extracts of the file the DataPlugin is editing.
Workbook Reference to the workbook to be loaded if you selected the Spreadsheet reader.
Use the Workbook object in the script to access the workbook and the associated properties.
FileName Reference to the file to be loaded if you selected Only Filename.
Use the DataPlugin object in the script to access the contents of the file.
FromStore Reference to the data store to be loaded if you selected the DataPlugin reader.
Use the Store object to specify how the information on a data model, for example, atfx files, is plotted on the TDM data model. You also can use the Store object to change, to rename, or to extend information about a TDM data model.
Document Reference to the document to be loaded if you selected the file reader Document.
Use the Document object in the script to access the meta properties of a document. A document can be an Office file in XML format, a PDF, JPEG, PNG, or TIFF file.

The ReadStore procedure has a second parameter which is generated when you enable the DataFinder Parameter setting in the New DataPlugin dialog box. The Boolean parameter DataFinderParameter specifies whether the DataPlugin is called from the indexer of the DataFinder (true) or from a different application (false). Use the DataFinderParameter parameter in the script to access mass data only then when the DataPlugin is not used by the DataFinder.

Option Explicit
Sub ReadStore(File, DataFinderParameter)

  'Switch behavior on the basis of the DataFinderParameter
  If Not DataFinderParameter Then
    'If DataFinderParameter is set to FALSE, the calling application supports bulk data
    'Implement single value access to bulk data within this If statement
    'This will accelerate indexing of DataFinder
  End If

End Sub
Was this information helpful?