Importing to another database

Hello Friends,
I am trying ti import 139 records from database “A” to database “B” to perform calculation and print reports. Everything works fine but I end up with 140 records in database “B”, one of them being empty. The following is the procedure I used:

OpenFile “Database B”
importdatabase “Database A”,“MatchingFields”,“YES”

According to the documentation you can use “Replace” to replace the entire database. I have put the “,Replace” right after the “YES”. There is an error saying it does not recognize Replace. Any help would be appreciated.

It sounds like database “B” has one blank record when you open it. A database can’t exist without at least one record.

I can’t get it to work using “Replace” or “Append” with or without a following value of “Yes”. My only option was to use Import/Import Panorama Database into Current Database from the File menu.

Thanks Gary,
I agree that the “Replace” does not work. The option on manually doing this through the file menu would not be a good option for me as I want to do all this through a procedure. I understand about a blank record needed in Database B. When I look at the recently imported database it always shows the blank record at the very top. Would it be possible after the import into Database B to select the blank record and delete it through a procedure?

Try this to select records that are empty and then remove them:

select emptyline()
removeselected

That did the trick. Thanks a bunch.

Except for the first parameter (the database name), all the options for the importdatabase statement come in pairs. There is no replace option, but there is an existingdata option that can be paired with a value of either replace or append. So your code would need to be:

openfile "Database B"
importdatabase "Database A","MatchingFields","YES","ExistingData","REPLACE"

There is an example in the documentation that shows the use of the existingdata option with the replace value.

Well, that’s what I get for scanning the documentation instead actually reading it through. I started out thinking Replace was an option when it was only a possible value for the ExistingData option. One gets a blind eye when they assume. :woozy_face: