Jump to main Content | Jump to main Navigation

Case study: importing a non-inflected text file

This case study shows you how to create an import format file for a non-inflected text file called Notes. Remember that non-inflected files consist of records with fields identified by the order or position in which they occur.

When importing any data into Calm, the first step is to look at the data in the text file. Notes looks like this:

1-4-90

Sarah Jane Hamilton
Tap Institute
803 East Pines Rd
San Diego, CA 22217
ph#s
331-253-4166/x104 or 167
616-204-1274
 abst>
postdoc asso, BSc biol 79, MSc biomed/ neurosci 83, MSc physiol 84, PhD physiol 87, South Univ since 87, neurosci, hippocampal slice prep, synapses, cyclic AMP, whole-cell patch clamp, neuromodulation.
--
1-4-90

Mark F. Grant
5243 Barley Dr
Raleigh, NC 38725
ph#s
828-763-8545
 abst
dir HR, BA psychology/sociology 65, MS personnel admin 66, PhD educ mgmt systems 74, Klax since 88, planning, performance, improvement, formulation, training.

Note the following points:

  • Both records have the same number of fields, in the same order. The fields are not tagged, but can be identified by the position in which they occur, therefore the file is non-inflected.

  • Each field is separated from the next by a separator. In this example the separators are not the same throughout the record, but importing is still possible.

  • Each record is separated from the next by a common separator (a line containing two hyphens).

  • Choose the fields you will require for the data. Ensure the correct field is chosen for each piece of data according to its data type. In this case the fields and their data types will be: Date (Date), Name (Text), Address (Text), Phone (Text) and Details (Text).

  • Choose a suitable record type which contains appropriate fields. In this case, User record type would be best.

The next stage is to create the import format file.

  • Click Import on the File drop down menu and change the method to Non-inflected. Click File to create a new import format file, then Edit to write the import format.

  • Firstly specify the record type you wish to import the data into, in this case User. Type the first line of the import format file:

:User

  • The Date field can be imported to the Expiry field. To import the date, type the following line:

Expiry=$

This tells DScribe to import the information up to the end of the line, represented by the dollar sign, into the Expiry field.

  • The next line in the records is a blank line. You need to tell DScribe to ignore it. Type the following:

=^$

The equals sign with nothing in front of it means ignore, and a caret followed by a dollar sign represents a blank line.

  • In the text file the name of the employee is on a single line. You need to import this into the UserName field. Type the following:

UserName=$

  • The next step is to import the address into the Address field. The address falls on several lines and each address ends differently. However, the line after the address, ph#s, is always the same so you can use that as the field separator. Type the next line as follows:

Address=^ph#s$

This will make sure that any data following the name of the employee until reaching a line consisting of ph#s is imported into the Address field.

  • Next you need to import the telephone number(s), into the Tel field. The numbers start on a new line and may be longer than one line. The line containing abst can be used as the field separator. Note that there is always a space before the abst.

Tel=^\sabst$

  • Finally, you need to tell DScribe to put the details into the Note field and, once at the end of record separator, to start a new record. The last line is as follows:

Note=^--$

The complete import format file for Notes reads:

:User
Expiry=$
=^$
UserName=$
Address=^ph#s$
Tel=^\sabst$
Note=^--$

  • Click File, Exit. Click Yes to save the changes to the file, then OK to import.