Log In    |    Knowledge Base    |    4D Home
Tech Tip: Creating a relation programatically
PRODUCT: 4D | VERSION: 2004.1 | PLATFORM: Mac & Win
Published On: February 24, 2005
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

In previous versions of 4D, the only way to set a relation was to draw one from the Database Structure view in Design environment. A new command in 2004.1 allows you to set a relation programatically. This command called, AP Create relationship, is brought to you through 4D Pack.

To set a relation you could write a command similar to the following:


This command will set a relation from [Table 1]Field1 to [Table 2]Field1 assuming Table 1 is the first table and Table 2 is the second table. The variable $status will contain an error code if the command failed.