KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Copying Related Fields Between Tables
PRODUCT: 4D Developer | VERSION: 11 | PLATFORM: Mac & Win
Published On: May 21, 2008

Unlike in 4D 2004, in the Structure Editor of 4D v11 SQL, you can copy a field and paste it to another table. This can come in handy for setting up a lot of relations between tables all at once. Just right-click (cmd-click on Mac OS) on the field you want to relate in the first table, and select copy. Then click on the second table to make sure it is selected, right-click (cmd-click) on it, and select paste.

The copied field will have the same definition, i.e. name, type, length, way it handles null values, etc. You can then immediately draw a relation from the copy to the original field. This is an easy way to make sure your related fields are not out of sync in terms of their definitions.

The second table will not get any data in the copied field. So if the first table has existing data in the that field, and you need it in the second table as well, you will need to pursue other means to bring that data over. However, the first table's existing data will not be changed or harmed by the field definition copy.