importdatabase
DATABASE
,
OPTION
,
VALUE

The importdatabase statement imports data from another database into the current database.


Parameters

This statement has three parameters:

database – database to import. (Note: You cannot import from the current database into itself.)

option – An option for customizing the way import works. See below for descriptions of each option. The option can be specified in either upper or lower case.

value – The new value for this option.


Description

This statement imports data from another database (which must currently be open) into the current database. In its simplest form you simply specify the database to be imported:

importdatabase "CompanyContacts"

The importdatabase statement normally appends the new data to the existing data in the current database. It puts the data from the first field in the imported database into the first field in the current database, the second field into the second, etc. If there are more fields in the imported database, the extra fields are ignored. You can change some of this behaviour with the options described below.

IMPORT OPTIONS

In addition to the text to import, you can also specify multiple option/value pairs in a single importdatabase statement, like this:

importdatabase database,option1,value1,option2,value2,option3,value3

The possible options are existingdata, matchingfields and selected. Each of these options is described in detail below.

EXISTINGDATA

The * importdatabase* statement normally appends the imported data to the end of the current database. You can use this option to tell it to replace the data instead.

importdatabase "Presidents","ExistingData","Replace"

Be careful! This will erase all of the existing data in the database! (Note: The replace option is not available for shared multi-user databases, attempting to use this option will cause an error.)

If you want to append the imported data, use append instead of replace (or just leave this option off).

MATCHINGFIELDS

As described above, the importdatabase statement normally imports the fields in sequential order – the first field in the imported database is brought into the first field in the current database, the second field into the second field, etc. If the matchingfields option is set to true, however, the import will match the fields by name. For each field in the current database, it will look for a field with the same name in the imported database and bring that data in. It doesn’t matter what the order of the fields in either database. However, the field names must match exactly, including upper and lower case, punctuation and spacing.

importdatabase “OldGeneralLedger”,“MatchingFields”,“YES”

SELECTED

The importdatabase statement normally imports ALL of the data in the imported database – whether it is currently selected (visible) or not. If you want to import only the selected records, use this option.

importdatabase "Transaction Log","Selected","YES"

See Also


History

VersionStatusNotes
10.2UpdateIf the database is shared (multi-user), you cannot use the ADDFIELDS or REPLACE option with this statement.
10.0NewNew in this version, but includes features that were part of the *OpenFile* statement in Panorama 6 and earlier versions.