Cynthia Heyman Posted June 13, 2017 Posted June 13, 2017 (edited) I have a layout where it shows a Person's information (name address etc), and it includes a Tab Control that lists all the dogs that are related to (owned by ) that particular person. I want to be able to click on a button that allows the user to add a new dog that is connected to the person showing. I have a Dog Details layout, I just need to pass the person key/information to the Dog Details layout so the dog is automatically added to that person. I've attached a screenshot of the Person Details layout with the Tab Control, and the Dog Details layout, where I'd like to have the Owner field automatically filled in when added a new dog. In my button control, I've tried a Single Step and the Go To Layout, and adding the Optional Script Paramater, using the Primary Key from the People Table, but it doesn't seem to be working. I'm very new at this and I'm sure there is an easy solution for those experienced users. Thanks! Cynthia Edited June 13, 2017 by Cynthia Heyman
Cynthia Heyman Posted June 13, 2017 Author Posted June 13, 2017 Thanks I'll read that over. I've been able to pass the record to the Dog Details Layout... but it passes everything, and I only want the Person passed, not the dog information.
comment Posted June 13, 2017 Posted June 13, 2017 56 minutes ago, Cynthia Heyman said: I've tried a Single Step Try a script. Something like: Set Variable [$ownerID ; Value: Owners:OwnerID ] Go to Layout [ Dogs ] New Record Set Field [ Dogs::OwnerID ; $ownerID ] If you prefer, you can pass Owners::Owner as the script parameter, and shorten the script to: Go to Layout [ Dogs ] New Record Set Field [ Dogs::OwnerID ; Get (ScriptParameter) ]
Cynthia Heyman Posted June 13, 2017 Author Posted June 13, 2017 9 minutes ago, comment said: Try a script. Something like: Set Variable [$ownerID ; Value: Owners:OwnerID ] Go to Layout [ Dogs ] New Record Set Field [ Dogs::OwnerID ; $ownerID ] If you prefer, you can pass Owners::Owner as the script parameter, and shorten the script to: Go to Layout [ Dogs ] New Record Set Field [ Dogs::OwnerID ; Get (ScriptParameter) ] 1 Filemaker doesn't let me type in the last line of your code.... Set Field [ Dogs::OwnerID ; Get {ScriptParameter) ] It seems to delete it when I click off the text... how can I get it to keep the text? I'm assuming it's not letting me because it's not a premade script item.
comment Posted June 13, 2017 Posted June 13, 2017 (edited) The Set Field [] script step has two parts (click the wheel icon to see them): In the 'Specify target field' part, select the field used by the Dogs table as the foreign key in the relationship to the Owners table. In my example, that's Dogs::OwnerID - your table/field names may be different; In the 'Calculated result' part, type: Get (ScriptParameter) or insert the function by double-clicking it in the functions pane. Edited June 13, 2017 by comment
Cynthia Heyman Posted June 21, 2017 Author Posted June 21, 2017 Thanks for your reply, and that works! I really appreciate it. Just read over the new Card feature in Filemaker 16... and maybe I'll see if I can get that to work instead, I like that idea.
Recommended Posts
This topic is 2711 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 accountSign in
Already have an account? Sign in here.
Sign In Now