1 Reply Latest reply on Mar 7, 2015 7:26 PM by philmodjunk

    Populating FK in child table. Can't believe I didn't know this!

    RickWhitelaw

      Title

      Populating FK in child table. Can't believe I didn't know this!

      Post

      When creating a record in a child table on a layout based on the child table ( which has to inherit the PK of the parent table) I figured out that there's a simple way that I just discovered. I've used FM for ages and never saw this. On the child layout create a field Child::FK which contains the foreign key of the child table. Make that field get its values from a value list defined as Parent::PK which shows the Parent PK values plus a second field. Say Name. Uncheck show only related etc. now when a value is selected the Child::FK is successfully populated with a proper match. Doh! An easy fix. I can't believe I never saw this before. Or maybe I did but forgot. Seems like a basic technique.

        • 1. Re: Populating FK in child table. Can't believe I didn't know this!
          philmodjunk

          Well this is what I've often called the "beginner level" "use values from field" value list. It's main draw back becomes evident when the value list becomes large and you have to scroll through a lot of values to find and select a value. Because the value list enters a number, you can't use a drop down list's auto-complete feature to "filter" the value list as you type in several characters.

          So I figured out a way to link records by ID using an auto-complete enabled value list that enters the name, but then looks up the ID. It requires a bit of added scripting, but it's much more user friendly.