You are here: Menu Commands > Database > Database > Export data
GEOVIA Surpac

Export data

You can use this function to unload data from your database into text files. This is useful for checking your data, making backups, and for transferring data to another database or to a different computer system.

Prerequisites: A database is open.

To run this function: Choose Database > Database > Export data, or Design > Blast design > Database > Export data, or...

  • In the Function Chooser, type UNLOAD DATABASE, and press ENTER.
Fields on the Select format file for load/unload form

Field Description
Database Name Read-only. The name of the database you are unloading data from.
Format File Name

The name of the format file. If you type a new name, and confirm the creation of the file, the Select database tables to include in format form is displayed. If the format file already exists, the Unload tables to text files form is displayed.

Report file name The name of a report file to hold any errors or information messages that occur during the export.
Format The file type and file extension of the report file.

After you click Apply, if you typed the name of a new format file, the Select database tables to include in format form is displayed. Otherwise, the Unload tables to text files form is displayed.

Fields on the Select database tables to include in format form

Field Description
Table Name Read-only. The names of each table in the database.
Include Whether or not to include the table in the format file.
Format
  • FREE. This is suitable when the fields in the text file are separated by a specified delimiter, such as a comma.
  • FIXED. This is suitable when the fields to load are in specific columns that have a fixed length.
Delimiter Only available for FREE fields. The delimiter is the character that separates fields in the text file that you are about to load.
Space Fill

Only available for FREE fields and only relevant when outputting.text files from a database.

  • Selected. A space is output after the delimiter.
  • Cleared. No space is output after the delimiter.
Text Qual.

Only available for FREE fields. The text qualifier is placed around any text and memo fields in the database, allowing you to have special characters (for example line breaks) in a text field. It is strongly recommended that you use a text qualifier at all times, but is only essential if the text field contains either line breaks, or the character defined as your delimiter.

For the qualifier to be correctly read into the database, the qualifier must be doubled. For example, the following is a valid text file, as output by Surpac and some other database products. It uses a comma delimiter and a double quote text qualifier. The following field value :

This is a test of "double" quotes

Will be output to a text file out of Surpac as:

"This is a test of ""double"" quotes"

When this field is read back, the doubled quotes ("") will be converted back to a single quote (") and so the data is not changed.

If the data did not contain the double quotes, however (for example the following) :

"This is a test of "double" quotes"

The data would be read into Surpac as

This is a test of quotes

because it stops reading at the first quote, and begins again at the second one.

For some field values, this could cause validation problems. For this reason, the qualifier must match what appears in the data. Another reason that the qualifier chosen when loading a text file must be correct, is that nothing may be loaded from the text file into the database. Loading to the database only begins when the text qualifier is first encountered.

When you click Apply, the Select fields to include in format form is displayed.

Fields on the Select fields to include in format form

Field Description
Table Name Read-only. The names of each table in the database.
Field Name Read-only. All the field names of the selected tables.
Include Whether or not to include the field in the format file.
Column

For a FREE format field, this field shows the column number in the text file. The column before the first designated delimiter in the text file is column one. The column that follows the delimiter is column two, and so on.

For a FIXED format field, this field shows the start position of the field in the text file. The first position is column one with the column numbers incremented for each character position on the line.

Length

Length is writeable only for FIXED format fields. It is the length of the field from the start column.

Format Read-only. Shows whether the field is FREE format or FIXED format.

Click Apply to display the Unload database tables to text files form.

Fields on the Unload database tables to text files form

Field Description
Table Name Read-only. The names of the tables in the database.
Text File Name

The name of the text file to unload data into.

You can leave this field blank if you do not want to unload a particular table. This feature enables you to reuse format files where there are more tables included than you want to unload at a particular time.

Click Apply to display the Define query constraints form. This is displayed so that you can constrain the data to unload if you want. If you do not wish to constrain the data leave the Define query constraints form blank.

If you are unloading the collar table, the constraint is applied to the collar table to determine which drillholes to unload. If you are not unloading the collar table, the Define query constraints form is displayed for each of the tables which you are unloading. The constraints applied to each table have no relationship to each other. For example, any constraints you make to the survey table have no effect on the constraints that you might apply to the assay table.

Fields on the Define Query Constraints form

Field Description
Table name Read-only. The name of the table you opened is displayed at the top of the form. Take special note of the table name because it shows you which of the database tables the constraints will be applied to.
Field name The name of the field on which you want to impose a constraint. If you leave Field name blank, all records in the table are selected.
Operand

The mathematical operation that defines the constraint. The operands are:

  • < less than
  • <= less than or equal to
  • > greater than
  • >= greater than or equal to
  • <> not equal to
  • = equal to
Constraint Value

The value for the constraint. Press TAB to add an additional row, or right-click in the left column to add or remove constraint rows.

When you have multiple constraint rows, Surpac returns only the records that pass all the constraints. However, you can use the hole_id field and the = operator to return records that pass only one of the constraints. In that situation, an OR operator is used between the constraints. For example, the following constraint would return two records:

  • hole_id = WRC075
  • hole_id = WRC044

Examples:

For a surveying example, to select all the survey stations with a specific status, you could add a constraint: status = C

The Constraint value for this constraint is C.

To select drillholes or survey stations in a particular area, you could add three constraints:

  • y < 9010.000
  • x > 2450.000
  • z >= 705.000

To select all of the holes where the collar is on a specific bench of an open pit, you could enter two constraints similar to these:

  • z > 149
  • z < 151
Load

Loads a constraint from the .dbc file you choose.

Note: Normally, a set of constraints is suitable for only the table on which it was created, or for tables that have the same or a very similar structure.

Save Saves the constraint to a .dbc file so you can reload it later.

Output

Data is unloaded to text files from the database. The Message window displays messages to inform you of the progress.