The import table utility allows you to generate a new madsearch2 table from the records of a delimitted text file. There are two steps in importing a delimitted text file:
You upload the delimitted file from your local computer so as to hand the file over to madsearch2.
Just as when you create a new table, madsearch2 will have you define the structure of the new table.
In structuring the table, madsearch2 will have your new table take on the field ordering that exists within the delimitted file. At this time, there exists no functionality to reorder fiels. Therefore, it is important that the ordering of fields within the delimited text file correspond to the ordering of fields you wish for your new table.
By default, madsearch2 assumes that the first line of the delimted text file is not a record, but rather the fieldnames of the following records' data fields. In defining the structure of your new table, there exists an option that disables this behavior and directs madsearch2 to treat the first line of the data file as a record to be imported. You may also rename the fields.
The first line of the delimited text file additionally indicates to madsearch2 how many data fields each record contains. During the import process, madsearch2 expects a consistent number of data fields. It is important to ensure that your delimited text records have a consistent number of fields separated by the same separator character. The delimiting of fields is optional except in cases where a data field value contains the separator character.
In defining the data fields of your new table, it is important to remember that all data integrity constraints specified within the "define table structure" area apply to the delimitted records that are imported. Should the record violate the primary key constraint, it will be rejected from insertion. should a field of a record fail the data integrity constraints imposed upon it by the underlying table structure (eg. field type, data length, formatting) it will be set to blank. in all cases, specific warnings will be issued by mad2.
After you define the new table's structure, the actual import process will begin. As madsearch2 imports the delimitted records, it will inform you as to it's progress. Should an error occur (eg. an inconsistent number of fields within a delimitted record), madsearch2 will report the error. Upon the completion of the import process, madsearch2 will present as status message indicating the number of records sucessfully imported.
in order to insert delimited records into a madsearch2 table, simply follow these instructions:
| :: phase one :: providing madsearch2 with the delimited text file | |
| step 1 |
From the madsearch2 menu, select the "Import Delimited File" option. The first screen on the madsearch2 import delimited file utility will appear. The first screen of the utility will prompt you as to where you wish to upload the delimited text file and from where on your local system it should look to obtain it. |
| step 2 |
In the field named, "Where Should I Put The Import File?", enter the directory path to which you may upload files. For example, /wwws/data/cu/pooh Please note that the upload feature uses madUpload. The target directory must have a .upaclu (user permissions file) or .upacla (affiliations permissions file) granting you the privilege to upload files. |
| step 3 |
In the field named, "Where Should I Get The Import File From?", type the location of the delimited file from which you wish to insert records. Note the handy "Browse" button your browser provides for assisting you in finding the file's location. For example, c:\mydocuments\addresses.txt |
| step 4 |
When you have reviewed your selections, click the "Send File" button to upload the delimited file from your local system. |
| step 5 |
The next screen that appears will contain an upload status message. You should verify that the number of bytes transferred corresponds to the size of your delimited text file. Should there be a problem during the transport, your browser will not warn you. It will simply pretend that all was well. If the number of bytes transferred reads "0", you probably misspelled the file to transfer or something similarly silly. Should this happen simply click your browser's "Back" button, correct the problem, and re-send the delimited file. |
At this point, you have confirmed that your delimited file was transfered in phase one of the table import process. The next step of the process, is to specify how madsearch2 should parse the uploaded delimited text file.
| :: phase two :: specifying the import parameters | |
| step 1 |
Beneath the file transfer status section, will be an "Insert Delimited Records" section. Within this section, find the field named "Table Directory". In this field, type the directory path where the new table will be created. For example, /wwws/data/cu/pooh |
| step 2 |
Next, in the field named, "Table Name", enter the name of the table you wish to create. For example, mytable |
| step 3 |
From the choices presented to you within the field, "Fields Are Separated By", select the character that separates the data fields which comprise your delimited records. The standard separator characters are among your choices: commas, tabs, and semi-colons. If you wish to use a different character, select the "Other" option and type the character you wish to use in the "Other" option's associated field. |
| step 4 |
From the choices presented to you within the field, "Fields Are Delimited By", select the character which delimits the data fields of each record. The standard delimiter characters are among your choices: quotes and nothing (no character at all). If you wish to use a different character, select the "Other" option and type the character you wish to use within the "Other" option's associated field. |
| step 5 |
When you have reviewed your selections, click the "Import File" button. madsearch2 will now attempt to parse your delimited text file. It will check to ensure that the number of fields is consistent within each record. Upon completing these checks, madsearch2 will display for you the "define table structure" screen. phase 2 is complete -- on to phase 3. |