AnsweredAssumed Answered

Auto-population of primary key fields in related tables

Question asked by MikeF on Nov 16, 2011
Latest reply on Nov 23, 2011 by MikeF

Title

Auto-population of primary key fields in related tables

Post

 

From former message in a thread now too long and unrelated…

Whenever I add a record in tblEvents, thereby triggering an EventID, need to have that, and indeed each, EventID in tblEventID automatically add itself to three tables. Again, have used Auto Enter Looked Up Value in each of those tables' EventID fields, expecting them to auto-populate. To no avail ..! How can this --- "auto-population" of EventID --- be accomplished??

I Put this in a script trigger OnObjectSave for EventID in the parent table, but it doesn’t work. Uncertain why not ...

Set Variable [$ID ; value: ParentTable::__pk_PrimaryKeyfield]
Freeze window
Go To Layout [//Layout for child table]
New Record/request
Set Field [ChildTable::_fk_ForeignKeyField ; $ID ]

  

At any rate, I wasn’t clear enough.

The records in the parent table will sometimes be imported en masse from Excel, sometimes added one at a time, and sometimes added [en masse] as a result of a script I’ll be working on down the road.

So to add one record at a time to the parent table won’t work.

Will effectively need to “sync” the tables’ primary key fields so all the records are the same all the time.

For clarity, the child tables do not have foreign keys, they all have one primary key field that needs to be identical to the parent.

Thanks,

  Mike

 

 

Outcomes