Jump to content
Sign in to follow this  
Cynthia Heyman

Add Record Button passing pk/name

Recommended Posts

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

 

Screen Shot 2017-06-13 at 2.22.21 PM.png

Screen Shot 2017-06-13 at 2.22.37 PM.png

Edited by Cynthia Heyman

Share this post


Link to post
Share on other sites

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.  

 

Screen Shot 2017-06-13 at 3.29.10 PM.png

Screen Shot 2017-06-13 at 3.29.28 PM.png

Share this post


Link to post
Share on other sites
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) ]

 

 

 

Share this post


Link to post
Share on other sites
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.

 

Share this post


Link to post
Share on other sites

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 by comment

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Content

    • By stan111
      Hi, 
      I created a dashboard with a bunch of buttons, attached script to every button, which allows me navigating to specific record of the Products table. Basically, every script is the same, with minor changes (only record ID field changes).
      The process of creating a script to every button is a very time consuming as I need to write a script that  a) goes to layout b)finds the certain record 
      1 "Step: Go to Layout
          Layout: Products
       
      2 Step: Perform Find" 
       
      Is there a way to simplify the task?
       
      Thanks!
    • By kolvorok
      Is there a way to show the hand cursor for a popover button? I've a lot of buttons on a layout - one of them a popover button - and I want it to behave like the others.
      FM Advanced 14, FM Server 15, macOS High Sierra 10.13.1.
    • By VapanPagan
      A little background
      I have a DB which keeps users logins/passwords for a business so they have all their login information for everything at work.
      My Issue
      I need the user to be able to click a button that creates a random password and places it into the password field when the button is clicked. I am making a button like this for each sections password field. I know I need to make a calculation, I have made these types of scripts before. However, how do I get to a calculation to perform this action with a button in filemaker? I am sure this is so obvious I will slap myself but right now I am at a loss. Maybe I have been working on these 5 solutions too long and need a break. LOL
      Any help, suggestions are very welcome...Thank you! =)
    • By liamob1
      Hi, 
      Got a real strange issue....
      My button bars look fine, slightly offset, but fine on the desktop version... But as soon as I look on FM Go, one of the text boxes just floats away? - I have tried moving it around and changing the size and i just get the same issue but with different buttons? 
      See images... 
      Thanks


    • By kathrynfw
      I am trying to create an option for dialogue to show up for users based on input they have provided. Rather than using up space for a merge paragraph on the page of the layout, it would be nice if they could click the help button and show the custom information related to each question based on their own input.
      When I try to set the button up to have merged fields in the dialogue, I do not see that option. I am using FM12 advanced.
      Thank you!
×
×
  • Create New...

Important Information

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