Date index for Aug 2002


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [achievo] [DEV] atkManyToOneRelation



Hi,

Dave Nuttall wrote:

It looks like the code is supposed to pull a matching record from employee where the userid field value in employee matches the value in usercontract.
What do I do if the field names in the related tables are not the same?

Doesn't matter. It takes the primary key field (which it knows because of the AF_PRIMARY flag) of that table, and stores it in the current table under the name you give it ("userid" in this case).


an atkManyToOneRelation is used in this situation:

Each contract is associated with exactly one employee, so when editing a contract, you want to see a dropdown of users.

The name of the attribute ("userid") is ofcourse the name of the field in the contracts table. This doesn't have to be the same as the field in the employee table. For example, see class.projects.inc, it contains a manytoonerelation with name "coordinator" and that works too.

By the way, relations will be discussed in detail in part 2 of the guide.

Greetings,
Ivo

--
Ivo Jansch <ivo dot 
ibuildings.nl BV - information technology
http://www.ibuildings.nl



http://www.achievo.org/lists achievo.org - ©1999-2002 ibuildings.nl BV