6.8 Accessing Metadata Associated with Imported Files

Metadata are data that in some way identify or describe other data. Within the context of data file import, metadata might include such things as the date and time of data acquisition and the data-file format. Origin is able to extract various bits of metadata and save this information when importing ASCII, binary and third party files. Some metadata are extracted by default -- the filename, path, file type, creation time and time of file import, for instance.

Other bits of metadata need to be specifically identified by you prior to file import. When importing data via the Import Wizard, you can extract user-defined variables from the header portion of ASCII or binary files and store them in the target workbook. For some third party files such as the NI DIAdem data files, specific information (for instance, time format, missing values, etc.) is automatically obtained and saved by the specific X-Function that handles file import (which, in the case of NI Diadem files, is impNIDIAdem).

Metadata can be saved in two places in the workbook:

  • The page.info area. The page.info area is an ASCII storage area associated with the workbook (which is in fact a page). Usually, it holds the filename, path, creation date, file type of the imported file and the import filter that is used to import the file. If user-defined variables are extracted from the headers of ASCII or binary files with the Import Wizard, these variables are saved to page.info.user.variables. This area will only store metadata associated with the last file that is imported into the workbook (if you are importing multiple files using the Wizard and you want to save user.variables information, you should import each file to a new book).
  • The binary storage area. The binary storage area can store more information than the page.info area. Besides filename, path, creation date, file type and user-defined variables, it can also hold special information obtained from third party files by the X-Function that handles file import. Another major difference between this area and the page.info area is that the old information in this area will not be overwritten when another file is imported into the workbook. A new node is simply added and the new information is added to that node, allowing you to store information on all files imported into that book.

You may want to use variables linked to the metadata saved in these two areas in your project. You can retrieve information on some items -- filename, for instance -- from either area. Your decision may depend upon what you are trying to do with this information. For instance, if you wish to update a variable value with each new import into the workbook, you should link to the page.info area. On the other hand, if you want to store variable values permanently with information on the source file from which they were created, they should be linked to the binary storage area.

Topics covered in this section: