Our Preferred 5 Star Hosting Provider - Award Winning FileMaker Pro Hosting
Results 1 to 5 of 5
  1. #1
    Forum Member
    Join Date
    Jan 2014
    Posts
    10
    Location
    Las Vegas, NV
    FileMaker Pro Software
    FileMaker Pro 13
    OS
    Mac
    Skill Level
    Novice
    Last Post
    05-04-2016
    Local Date
    10-18-2017
    Local Time
    08:00 AM
    Last Active
    05-04-2016

    Creating new record in related table using button

    This is a really simple scripting issue, but I can't seem to find any concrete help on this so here;s the question:

    I have two tables: parent and child. I would like to ave a button that creates a related child in the parent layout. So far my script for the button looks like this:

    Go to Layout ["Parent" (Parent)]
    New Record/Request
    Set Field [Child::RelatedParent; Get(Parent:ID)]

    However, this will not run because it returns the following error "This parameter is an invalid Get function parameter"

    I've tried other Get functions but I can't seem to find the right one. Both of my fields are numeric, does that matter?

    Please let me know if you have any insights! Sorry for such a novice question!

    Best,
    Warning: This is an Old Thread
    This discussion is older than 420 days. information contained in it may no longer be current

  2. #2
    Senior Moderator - FMT Preferred Developer Consultant - New York - Worldwide AHunter3's Avatar
    Join Date
    Aug 2006
    Posts
    12,175
    Location
    New York and Nassau County, NY, USA
    FileMaker Pro Software
    FileMaker Advanced/Developer 14, 13, 12, 11, 10, 9. 8.8, 8, 7, 6, 5.5 FileMaker Pro 8, 7, 6, 5.5, 5
    OS
    Windows & Mac
    Skill Level
    Developer
    Last Post
    10-17-2017
    Local Date
    10-18-2017
    Local Time
    11:00 AM
    Last Active
    10-18-2017
    Go to Layout ["Parent" (Parent)] This is the table where Parent records are created. You want to create a new CHILD record. You're in the wrong place
    New Record/Request See? Now you just created a new PARENT record. Not what you wanted, right?

    Instead you want to trap for the parent table's ID field value, do the equivalent of scribbling it on the back of a piece of scrap paper...

    Set Variable [$ParentID; Parent::ID]


    ... then go to the CHILD layout and create a new record THERE instead...

    Go to Layout ["Child" (Child) ]
    New Record/Request


    ... and set the RelatedParent field to the parent table ID that you put into that variable:

    Set Field [Child::RelatedParent; $ParentID]

    ... then go back to where you came from:


    Go to Layout [original layout]



    meanwhile...


    Get(Parent:ID) <—— FileMaker is complaining about this. It is INDEED not a valid Get function.

    You don't use Get to obtain a field value, you just reference the field as Table, two colons, and fieldname: Parent::ID


    Note that you only put one colon.


    Get functions are quite specific. Most of them reference values that are NOT in fields:

    Get (CurrentDate )
    Get (ActiveModifierKeys)
    Get (SystemPlatform)
    Get (DesktopPath)

    etc

  3. #3
    Forum Member
    Join Date
    Jan 2014
    Posts
    10
    Location
    Las Vegas, NV
    FileMaker Pro Software
    FileMaker Pro 13
    OS
    Mac
    Skill Level
    Novice
    Last Post
    05-04-2016
    Local Date
    10-18-2017
    Local Time
    08:00 AM
    Last Active
    05-04-2016
    Wow, thank you so much! And thanks for taking the time to make sure I understand what I'm writing!

    Really appreciate the help -- works like a charm now

  4. #4
    Forum Member
    Join Date
    Nov 2016
    Posts
    2
    Location
    Heinkenszand, Netherlands
    FileMaker Pro Software
    FileMaker 15 Pr Advanced
    OS
    Mac
    Skill Level
    Novice
    Last Post
    11-16-2016
    Local Date
    10-18-2017
    Local Time
    04:00 PM
    Last Active
    11-25-2016
    Hi there,

    I'm trying to use the above solution as I want to create a related child record via a button on the Parent layout, opening Child layout etc.

    However I'm unable to add the last part of the Set Field "$ParentID" and I don't know where I'm going wrong. Whatever I do it FM keeps coming back with " an operator is need here". Obviously I missing something but I seriously do not know what. Can someone help me out please?

    Thanks,
    Ingrid

  5. #5
    Forum Member
    Join Date
    Nov 2016
    Posts
    2
    Location
    Heinkenszand, Netherlands
    FileMaker Pro Software
    FileMaker 15 Pr Advanced
    OS
    Mac
    Skill Level
    Novice
    Last Post
    11-16-2016
    Local Date
    10-18-2017
    Local Time
    04:00 PM
    Last Active
    11-25-2016
    I see it's the below solution instead of the above. New to the forum:-)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 9
    Last Post: 08-28-2015, 09:55 PM
  2. Replies: 6
    Last Post: 12-12-2010, 08:03 AM
  3. Creating an either/or for a New Record button
    By saltobello in forum FileMaker Pro 8.5
    Replies: 7
    Last Post: 05-07-2009, 10:44 PM
  4. Replies: 1
    Last Post: 05-07-2007, 06:13 PM
  5. creating new record in a related table
    By elford in forum ScriptMaker and Scripting
    Replies: 6
    Last Post: 05-26-2006, 05:33 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Welcome to the Original FileMaker Forum
With designated forums for almost every FileMaker topic...FileMaker Today is a FREE to join community where you can boost your FileMaker expertise, build better apps & solutions and interact with over 42,000+ FileMaker Developers from all over the world. If you're building FileMaker solutions, this is the place for you.
Follow FMT
We Are FMT
FMT is home of The World's leading FileMaker News Site, Worldwide Developer Directory, FileMaker Connect Community and so much more.