KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: User Mode Import using 4D Forms
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: August 1, 2007

When importing data into 4D it is often useful to execute a method which does some sort of error or redundancy checking. At first glance it may seem that this cannot be accomplished with the built-in User Mode Import feature. However it is possible to execute 4D code even during a User Mode Import. By importing data using a form it is possible to still execute a method via form events, even though the form is not being used in the standard input mode.

To do this click the Form tab located at the top of the Table and Field Selection Area:



The list of forms in the selected table is displayed, so that you can choose a form for the import. The data will be imported into the fields on the form using the entry order of the form.

Forms that contain enterable variables and fields, but not buttons, are acceptable for this procedure. The form method and the methods associated with variables and fields will be executed when each record is imported. Note, however, that the effects of these methods are not shown in the Preview area. The On Validate form event is triggered for each record handled via the import.

If you use a form for the import, please keep the following considerations in mind:

  • The entry order of the form determines the order in which the columns of data are imported.
  • If there are fewer fields and variables on the form than columns in the text file, the extra columns will be ignored.
  • A form used for import cannot contain buttons and subform objects are ignored.


For these reasons it is advisable to create a form to be used only for importing data into 4D.

For more on importing data using a form check the 4D User Reference, which you can download from here:

http://www.4d.com/support/documentation.html