Join Databases (appending fields)

I’m trying to merge two databases by appending the fields from one into the other. Like this:

 **db1**          **db2**
 id  A            id  B      <-- fields
 1   x            1   cat
 2   y            2   dog
 3   z            3   fish`

“id” is a key field. Join/merge/append/import them to get:

 **merged_db**
 id  A   B
 1   x   cat
 2   y   dog
 3   z   fish`

I could not get this to work using “Import Panorama Database into Current Database”.
Other suggestions?

The options in “Import Panorama Database into Current Database” are for adding or replacing records from db2 into db2 in fields which exist in both, not for adding additional, unshared fields. But since you’ve set up key field ‘id’ what you want is easily done:

Open both db1 and db1.
For db1:
AddField “B” to it
Select Field B in db1
Choose Morph Field… , choose “Start with the Formula” there and enter this Formula:
lookup(“db2”,«id»,«id»,«B»)

Thanks for the quick reply!

My actual situation is a bit more complicated. I actually have 20 fields in db2 that I want to append into db1 while using “id” as the key field. Is there a function I can use in a procedure to pull in and create the fields from db2 into db1?

I might just pull them in one at a time as you’ve described. Again, thanks for the help!

In Panorama, “append” means to add records on to the bottom, there’s no key involved. You are using “append” to mean appending new field on the right, basically similar to an SQL join operation. It might someday, but Panorama doesn’t currently have an integrated operation like that. The only way to do it is with the technique John described. If I was doing this myself, I would add field “B” manually, but the rest of the steps I would do in procedure code, like this:

field B
formulafill lookup("db2",id,id,B)

The advantage of using procedure code is simply that I can easily edit the code and run it over again and again if needed, for example if I made a mistake. If you use the Morph Field command you would have to type the formula in again each time.

Ah, yes, join … that’s what I’m doing. Not so good with database terminology yet.

Thanks for the help. This will get me where I want to go.