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

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

Recommended Posts

Posted (edited)

Hi to the community.

I've searched the forum and have been unable to find a working solution to my question.

I'm certain I'm missing something simple.

I have 2 tables, "Items" and "Details"

The relationship is set up with allow creation

checked on in details. Primary key in "items" is linked with and matches foreign key in "details".

Two issues to resolve.

First, I'm unable to get my "go to related records" script step to work. The foreign key

field in "details" isn't populating.


if[isEmpty(details::kp_id_details)]

 Go to Layout ["details"(details)]

 New Record/Request

Else

 Go to Related Record [show only related  records; From table: "details"; Using layout: "details"(details)]

End if




The second issue is the button in details layout

which creates a new record. It doesn't insert the

the foreign key for the current parent record.

It seems to lose "scope". 





Set Variable [$ID; Value:details::kf_id_items

Set Field [details::kf_id_items;$ID]

I've attached a small sample.

Thanks in advance for any help.

newRec.fp7.zip

Edited by Guest
Posted (edited)

Set Variable [$ID; Value:details::kf_id_items

You are assigning the wrong value to $ID.

$ID must be set to the PRIMARY KEY from ITEMS and you are missing the switch to valid layout based on DETAILS - everything else looks fine.

Incidentally, if there are no records in the current found set then your button should stop before attempting to create a related record.

Did you think you could create related records on the primary layout? If you want to do that then you must have a portal to display the related records and use the portal to build your related records, but you do not need to pass $ID through on this one because FM knows the relationship and will automatically set the foreign key.

Edited by Guest

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