Our Preferred 5 Star Hosting Provider - Award Winning FileMaker Pro Hosting
Results 1 to 5 of 5
  1. #1
    Gold Member
    Join Date
    Aug 2009
    Posts
    39
    Location
    Torrance, CA
    FileMaker Pro Software
    FILEMAKER PRO 11 ADVANCED
    OS
    Mac
    Skill Level
    Intermediate
    Last Post
    11-21-2017
    Local Date
    11-25-2017
    Local Time
    01:33 AM
    Last Active
    11-24-2017

    How to use Set Field

    Can someone please explain the Set Field script step?

    I have attached a simple file, with a one step script.

    It seems to me that this script should change Field B in Layout 1 to the value of field D from Layout 2. But when I run the script nothing happens.

    TIA
    Attached Files Attached Files

  2. #2
    FileMaker Mentor
    Join Date
    Aug 2015
    Posts
    111
    Location
    Broomall, PA USA
    FileMaker Pro Software
    FM 16 Advanced
    OS
    Windows
    Skill Level
    Intermediate
    Last Post
    11-18-2017
    Local Date
    11-25-2017
    Local Time
    04:33 AM
    Last Active
    11-24-2017
    Set Field By Name requires the field to be on the layout. If you ran your script with the debugger you would see it gives an error "Layout object missing"

  3. #3
    Gold Member
    Join Date
    Aug 2009
    Posts
    39
    Location
    Torrance, CA
    FileMaker Pro Software
    FILEMAKER PRO 11 ADVANCED
    OS
    Mac
    Skill Level
    Intermediate
    Last Post
    11-21-2017
    Local Date
    11-25-2017
    Local Time
    01:33 AM
    Last Active
    11-24-2017
    I am guessing that you meant that either Field D had to be on the layout containing Field B ( or vice versa). I tried this both ways; fields D and B are on both layouts. Running the debugger shows an "(102) Field is missing" error in both cases.

  4. #4
    Good guy doughemi's Avatar
    Join Date
    Apr 2005
    Posts
    1,280
    Location
    Middleport, NY USA
    FileMaker Pro Software
    FMPA 14
    OS
    Windows & Mac
    Skill Level
    Intermediate
    Last Post
    11-07-2017
    Local Date
    11-25-2017
    Local Time
    04:33 AM
    Last Active
    11-25-2017
    Set Field by Name requires a literal text (or variable which contains literal text)(or calculation resolving to literal text) describing the target field's name. IOW, the script step should be
    Code:
    Set Field by Name("Table1::B"; Table2::D)
    It is typically used where you need to calculate the field name, not for setting a field whose name you know.

    The way your script is written, FM is looking for a field named "" (which is the content of Table1::B) to set, which, of course doesn't exist.
    Give the gift of life. Register as an organ donor today!
    http://www.organdonor.gov/becomingdonor

  5. #5
    Senior Moderator - FMT Preferred Developer Consultant - New York - Worldwide AHunter3's Avatar
    Join Date
    Aug 2006
    Posts
    12,187
    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
    11-22-2017
    Local Date
    11-25-2017
    Local Time
    04:33 AM
    Last Active
    11-24-2017
    The main problem is that you're using the wrong command entirely. Your thread title refers to the use of Set Field. You didn't PICK Set Field, you picked Set Field By Name.

    Set Field By Name is a wonderful power tool but it's for doing something more complicated than what you're trying to do.

    a) Delete the Set Field By Name and replace it with Set Field

    b) Now set it up just as you attempted to set up Set Field By Name:

    Set Field [TABLE 1::B; TABLE 2::D]



    If you'd picked the correct command, your usage would have been correct all along.

Thread Information

Users Browsing this Thread

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

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.