AnsweredAssumed Answered

Add record through relationship

Question asked by JillX_1 on Aug 22, 2012
Latest reply on Aug 22, 2012 by philmodjunk

Title

Add record through relationship

Post

I have tables Model and FC

In table Model, there are fields Factory, Model. Each model number has one record, and there are more than one model under each factory.

In table FC, there are fields Factory, Contact. Every factory has one record.

Relationship is:   Model::Facotry=FC::Factory

I use this relationship to draw contact information from FC to Model table, so that every factory in Model table is associated with one Contact information to table FC.

Now the problem is, If I want to add new  model or new factory to Model table, I want FC table to be updated simultaneously. 

I tried with the idea adding Factory Code column to both tables. First I had number generated at table FC, and use calculation Model::FCcode= FC::FCcode to create codes in Model table. While because code number in Model table is calculated and not stored, I can not use the code as relatioinship. And if I change value type of Model::FCcode, the whole field will go empty because not stored value, which blocked me from establishing relatonship through Code.

Now I have script:

 

New Records/Request

Go to layout[Model::Factory]

Set Variable[$newfc;Value Modle::FC]

Go to layout["FC"(FC)]

New Record/Request

Set field [ FC::Factory;$newfc]

Go to layout[original layout]

Commit Record/Request

 

This script allows me adding a new record to FC table, but not filling the new factory field record with the one added to Model table. I was thinking maybe because the record adding to table FC is already finished before I actually typed in anything. 

How can I achieve adding to two tables simultaneously? How can I establish valid relationship allow me to do that?

 

Thank you so much!!!!

Outcomes