GMS:Import From Database: Difference between revisions

From XMS Wiki
Jump to navigationJump to search
Line 16: Line 16:


== Step 3 – Viewing the Results of the Query ==
== Step 3 – Viewing the Results of the Query ==
Step 3 displays the results of the database query.  Only the first 20 rows are displayed in a spreadsheet.  If the results are not what you wanted, you can go back to Step 2 and modify the query.
Step 3 displays the results of the database query.  Only the first 20 rows are displayed in a spreadsheet.  If the results are not what were wanted, the user can go back to Step 2 and modify the query.


== Step 4 – Assigning Column Types ==
== Step 4 – Assigning Column Types ==

Revision as of 16:52, 28 July 2014

The Database Import Wizard allows users to access data stored in a database and import it. The wizard is invoked by selecting the Import from Database command from the File menu. The data types that can be imported by the Database Import Wizard are the same data types that are supported by the "File Import Wizard".

The Database Import Wizard has four steps:

Step 1 – Connecting to a Database

Step 1 of the wizard lets the user set up a connection to a database. To connect to a database either on the same computer or on a network press the Connect to Database button. Once a database connection is created, a path to the database and the different tables in the database are displayed. When a table is selected its columns are displayed along with the number of rows in that table.

Step 2 – Querying Information from a Database Table

Step 2 allows theuser to create, copy, delete, and import queries that retrieve data from a database. To help in writing the queries, the tables in the database are displayed, as well as the columns in the selected table.

Some SQL Basics The query is an SQL (Structured Query Language) statement. The SQL statement is entered in the Query SQL statement edit field. An example of an SQL statement would be: “SELECT x, y, z, toluene FROM multipledatasets”. This statement means that columns x, y, z, and toluene from the table multipledatasets will be retrieved from a database. SQL statements are case sensitive. SQL statements also require brackets around table or column names that have spaces. For example, to query data from a table titled “x coordinate” in the SQL statement it would be written as [x coordinate]. A full explanation of SQL is beyond the scope of this document.

The user can write a short description for each query in the Query description edit field. The New button creates a new query that has a default name, description, and SQL statement. The Copy button creates a copy of the currently selected query. The Delete button deletes the currently selected query.

The defined queries are saved automatically by GMS in a file called gmsquery.ini, located in the folder where GMS is installed. The Import button allows the user to import a list of queries from any file that follows the same format as the gmsquery.ini file.

Step 3 – Viewing the Results of the Query

Step 3 displays the results of the database query. Only the first 20 rows are displayed in a spreadsheet. If the results are not what were wanted, the user can go back to Step 2 and modify the query.

Step 4 – Assigning Column Types

The first 20 lines of the file are displayed in a spreadsheet according to the file outline specified in step 1. This step lets you pick what kind of data you are importing (see Supported File Formats). A "no data flag" can be specified for the file. This is a number that, when encountered in the file, tells GMS to mark the value as "NULL" or "no data".

The data in the columns are identified by selecting the type in the combo box at the top of each column in the spreadsheet. If a row of headings exists, GMS will automatically select the proper type if it recognizes the heading. Otherwise they are Not Mapped by default. The available column types changes depending on the GMS data type selected. Certain column types must be mapped for each file format before the user can progress to the next step in the wizard. The name of each column is changed by editing the Header cell.

After the data have been imported, the GMS:Coordinate Transformation tools can be used to transform and translate the data.