Knowledge Base

Converting text file to a database


Text files are often used as files with data for the labels. Text databse are usually generated from some software that does not have the label-printing features. NiceLabel can use the text file and print the data on the label, thus adding label-printing capability.

The text file is not a real database. This brings two major limitations:

  1. The text file doesn't have stored the definition of the fields.
    The applications can be aware of the field name (if it is stored in the first line in the text file), but not aware of the structure of the text file. The information about fields types (numeric, alphanumeric, etc.) and field lengths is not known and you have to set it manually.
  2. You cannot define indexes in the text file.
    Because of this fact the database connectivity options in NiceLabel software are limited. For example, you cannot change the printing order, or you cannot define a filter on some field.


There is an easy way in NiceLabel software to convert the text file into the real database. The idea is the following: Use NiceData to define the structure of the text file, then use NiceData to save text file into a real database.

Follow these steps:

  1. Start NiceData.
  2. Open the text file.
  3. The structure of the text file is not known so Text File Wizard opens.
  4. Follow on-screen instructions and define the structure of your text file.
    You can store the name of the fields in the first line of the text file.

    When you define the structure of the text file, the definition will be save in the file with extension .SCH in the same folder, where the text database is stored. When you open the text file some other time, the structure will be read from the definition .SCH file.
  5. Create a new empty database in NiceData. Make sure the database has the same structure of fields as the fields in your text file.
  6. Close the new database in NiceData. Leave the text file opened.
  7. Select the command Fill from the Tools menu.
  8. The text file is selected for the 'Source Table'. Select your empty database for the 'Destination Table' field.
  9. Click on the Map Fields button.
  10. Link the appropriate fields from the text file and from the database. If the fields have the same names, NiceData will link the automatically.
  11. Click OK to return to the Fill Table dialog box.
  12. Click OK to begin with the filling of the table.

Note: the same procedure can be applied automatically. You can use NiceData command-line switches and control the conversion process from some other information. For example, you can define a form in NiceForm where a click on a button will convert text file into real database. Refer to the NiceData help file.

Print document   Email document


Did this article help you? *