June 13, 20178 yr 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, 20178 yr by Cynthia Heyman
June 13, 20178 yr Author 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.
June 13, 20178 yr 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) ]
June 13, 20178 yr Author 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.
June 13, 20178 yr 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, 20178 yr by comment
June 21, 20178 yr Author 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.
Create an account or sign in to comment