4D v16

Importing

Home

 
4D v16
Importing

Importing    


 

 

In addition to the manipulations explained in the video, you should also note that:

When importing Boolean values (True-False in 4D), you can request an automatic conversion:

  • by going to the last tab of the Import dialog box
  • and specifying values such as "yes;no", "internal;external,", "Male;Female", etc.

4D automatically converts the imported data (the first value to True and the second to False).

You can also provide users with access to the import or export dialog box using the following commands:

  •  IMPORT DATA("")
  •  EXPORT DATA("")

When you perform an import using a form, the form contains the fields receiving the data. The entry order of the form must be the same as the order of the columns in the import file.

In this video, we'll learn how to create a table directly when importing data.

We have already imported data into the Interventions and Technicians table.

To save time and quickly retrieve existing information already entered in another database or in a spreadsheet, we are going to see how to create a table directly when importing data from a tab-delimited text file.

We'll perform an import like we did in previous videos.

  • "File" => "Import" => "From File..."
  • This display a list of all the files
  • And we can select "places.txt"

The import settings dialog box appears:

  • Click on "Create Table"
  • Then enter a name for the table
  • Then, in the 2nd tab named "Header", check the "Column Titles as Field Name" box

Fields are then created automatically and typed by default according to their contents.

Back on the 1st tab, we can still run into problems with accents so let's change the file and then we can indicate which type of field we want to set for each column.

  • Here, Alpha is fine
  • Alpha
  • Alpha
  • For the zip code, we recommend using Alpha
  • And for the City as well.

Once these settings are made, click on the "Import" button.

The data is imported and then 4D offers to create forms for this new table.

As we have done so far, we click on Yes.

There are other ways of importing available in 4D:

  • Import by forms
  • ODBC import
  • Importing data from former databases, through conversion
  • Connection to other databases
  • Programmed import

Using this same Import dialog box, File => Import => From File, you can import data using a form. We are going to simulate this without actually going through with it.

For example, in the places.txt file, we can import data using a form.

The idea is to create a specific form, dedicated to importing data where we have programmed object methods or the form method itself so that they perform automatic checking, reformatting or automatic filling in of calculated fields, etc. just as if the user was entering data directly in this form.

Later on in the programming, we can carry out imports using the Open document and RECEIVE PACKET commands, which we will see in another video.

 
 

 
PROPERTIES 

Product: 4D
Theme: Importing

 
HISTORY 

 
ARTICLE USAGE

Self-training ( 4D v16)