You are here: Tutorials > Geological Database > Geological Database Tutorial > Importing and viewing data > Task: Import data from text files
GEOVIA Surpac

Importing and viewing data

Import data

Task: Import data from text files

You will import geology and sample data into the database.

  1. Open sample.txt in a text editor
  2. The fields are comma delimited and represent depth_from, depth_to, gold, hole_id, and sample_id.

  3. Close the file.
  4. Open geology.txt in a text editor.
  5. The fields are comma delimited and represent depth_from, depth_to, hole_id, and lithology.

  6. Close the file.
  7. Connect to add_optional_tables.ddb.
  8. Choose Database > Import data.
  9. Enter the information as shown, and click Apply.
  10. If a format file of the same name exists it will be used.

    Note: Surpac does not check whether the format file matches the data to be imported.

    If no format file exists, the following form is displayed.

  11. Click Apply.
  12. This creates a format file which, if the structure of the text file being imported remains the same, can be used each time you import data in the same format.

  13. Select the tables that you want to insert the data into, in this case the geology and sample tables.
  14. Note: Make sure you scroll down and clear the check boxes for tables at the bottom of the list.

  15. Click Apply.
  16. Select the field names you want to include for the geology and sample tables, and enter the column number of the data in the text file as shown.
  17. Click Apply.
  18. Select the Text File Name and Load Type for the tables.
  19. Note: If you select Perform overlapping sample check, an error is recorded in the report file if the data for any holes overlaps. Allowing a small number of errors before the process stops can be useful.  These error records do not go into the database, they are stored in a reject file with an explanation for the error.

    Note: The Insert option does not replace existing data in the database; the Update option does replace existing data in the database.

  20. Click Apply.
  21. The following is a sample reject file, where a header record has been read as an error and sent to the reject file with two other rejected records.

    An explanation of the errors is given in the report file.

    Note: To see all of the steps in this section, run 02a_importing_data.tcl. You need to click Apply on any forms presented.

Viewing data

You can view data directly from the Access database by dragging the .mdb , or .accdb, file into the graphics workspace. After the data has been imported, you can view and edit tables using options from the Edit menu.

When selecting View table constrained, the Define Query Constraints form allows the data to be filtered depending on the values for a particular field from that table. You can also use multiple constraints, but all of the conditions must be met for the data to be displayed.

Task: View data in a table with constraints

  1. Connect to surpac_training.ddb.
  2. Choose Edit > View table constrained.
  3. Enter the information as shown, and click Apply.
  4. The Define view/edit rows template form is displayed.

  5. Click Apply.
  6. Enter the information as shown, and click Apply.
  7. Note: Right-click in the space below the current row and select Add from the shortcut menu to add a new row.

    The holes that meet all three of the above constraints are displayed.

  8. Click Apply.
  9. Close the database.

Note: To see all of the steps in this task, run 02b_viewing_data.tcl.  You need to click Apply on any forms presented.