Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Create record in related one-to-one table?


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

Recommended Posts

  • Newbies
Posted

Hi,

Is there a way to automatically enter data in fields of a related table when you create a new record in a table it's linked to? I have two tables--the main "data" table, and its related "lock" table with fields for whether the data record is new, imported, exported, or locked. When I create a new record in the data table, I want a new record created in the lock table at the same time, with initial values of locked being false. I have the locked field placed on the data layout, but the value is empty when a new record is created.

It's a one-to-one relationship, and "allow creation of records" is checked.

Any ideas?

Thanks,

Matt

masterlock.zip

Posted

Unless there is a compelling reason not to, one-to-one relationships should be eliminated and the tables combined. It's not clear what the purpose of these tables are.

To answer your question: while it's possible to create records in multiple tables through relationships, it's not possible to automatically create records in related tables when a record in the current table is created. You could use a script to do this.

Posted (edited)

Matt

If you are scripting the creation of the new record then you could simply add a line,

Set field (The field you want to set,''Locked'')

immediately after the create new record line.

If not scripting then set the field (in define database - fields) to have an auto entry of data 'Locked'

Phil

ps I defer to ender cos I didn't look at your file and......he is a lot cleverer than me!!

Edited by Guest
posted before I saw enders reply
  • Newbies
Posted

Thanks Ender and Phil.

This is just a dummy database--I'm trying to get record locking to work (as well as scripted exporting/importing). If I put the record locking field in the main table, it can't be unlocked later by the user when the record is locked, so I thought I could put it in a separate table.

I have auto entry set up, but because no record is created, nothing is set. I tried writing a script to make a "new record" button that would create a new record in each table, but I can't figure out how to specify which table to put a new record in--it just makes two new records in the data table, and does nothing to the lock table.

New Record/Request

Go to Field[select/perform; lock::Locked]

New Record/Request

Set Field[lock::Locked]

Is there an easier way to allow users to lock a record, and then unlock it later when they need to make a change?

Thanks,

Matt

  • Newbies
Posted

Oops! Forgot to enter a value! This seems to work:

New Record/Request

Go to Related Record[From table:"lock"]

Set Field[lock::Locked;"N"]

Posted

I think the whole Lock table can be eliminated.

Can we assume you are using record level privileges to decide if a user can edit a record? If so, then simply build more conditions into that calc:

Status = "Open" or

CreatedBy = get(accountname) or

get(accountname) = "admin" or

gOverride = 1

...

This topic is 7044 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.