Jump to content
Server Maintenance This Week. ×

Create Record in a Related Table


mruepp

This topic is 7012 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I am desperate: I am trying to make a tape database with shotfinder. I created two tables, one tapes and one shots. I created in Tables a Field called Tape_ID (autoserial) and in Shots a Field Tape_ID. I made a single relationship (Tape Table creates Tape_ID in Shot Table).

No i want to create a Table with Tape Infos and want to create a Button with "Related Shots". When clicking on this Button, every related Shot of the choosen Tape should look up in an other Layout (List view). In the Shots Layout i want a button "New Shot" which will create a new Record related to the Tape choosen before, and i can type in the shot specific information.

It worked to view with following Layout (I choosen Table Tapes from Layout Setup) and put the whole Fields from the related Shots Database on it. But when i make a new Record, I get a new "Tape" Record, not a new "Shots" Record.

And i also not found out how i can put a Button on the Tape Layout "New Shot", which will get me to a new Layout where i can type the new Shot in, and this will automatically associate with the Tape Database.

I am an absolute Newbie so be patient with me,

Thanks alot,

Mike

Link to comment
Share on other sites

Here's an example of what I think is the most efficient way to do this. It uses the new ability of a script to pass a "script parameter". This allows you to use the same "New Shot same Tape" script from two different places, and still get the correct TapeID.

Double-click the buttons, in Layout mode, look down at the bottom of the dialog, to see the script parameter.

1. You're on a Tape layout, with a Shots portal.

The script parameter is:

Tapes::TapeID (the current TapeID)

Go to Shots layout

New Record

Set Field [ TapeID;Get ( ScriptParameter ) ]

2. You're on a Shot layout

The script parameter is:

Shots::TapeID (the current TapeID)

Go to Shots layout

New Record

Set Field [ TapeID;Get ( ScriptParameter ) ]

The only difference is in the Script Parameter, in which TO is used to reference the TapeID.

So it's 1 script, with 2 slightly different parameters being sent from the button.

[Actually, the Tapes::TapeID script parameter would work in either place, because the relationship is valid to the original Tape from Shots also. But it is more politically correct to reference the local TapeID field ???-]

This method is simpler than passing the value in a global field. It is not as "visible" however (with global fields you can see what's being passed in the script itself). You have to pay attention, especially if you copy/paste the same button to another table's layout.

(P.S. I did not use "Allow creation of related records" I could have, but it has limitations, and since you're using the same script in both places...)

TapesShots.zip

Link to comment
Share on other sites

This topic is 7012 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.