FileMaker Selector Connector: The Basics

Background

This post builds on the session I presented at DevCon 2015: Data Modeling Beyond Anchor Buoy which described the FileMaker Selector-Connector pattern for the relationship graph. At DevCon we also went through some sample files which are available here. We’ll reference those files in this article as well. (You can also think of this as a continuation of my the earlier post on Selector-Connector: “FileMaker Data Modeling with Selector Connector“.)

DevCon 2015 was an exciting time for the Selector-Connector Model as Todd Geist won the Excellence award for both developing and formalizing the idea. I was very fortunate to have the opportunity to collaborate with Todd as the idea was developing. This collaboration lead to the current model used in our SeedCode Complete template, and was the basis of my DevCon presentation.

Why A New Model?

On of the things I wanted to stress in my DevCon session is that there was never an intention to come up with something new in the abstract sense of a “model”. Todd and I both had a specific problem we wanted to solve: we wanted to build portable choosers (aka pickers and selectors), e.g. a chooser that we could easily move from layout to layout. Not only would this make our development go considerably faster, but in the case of SeedCode Complete, our customers would be able to take advantage of this portability as they customized and expanded the template.

As it turns out, there are other benefits to the Selector-Connector that emerged, but focussing on the chooser is arguably best way to understand Selector-Connector.

An Anchor Buoy Chooser

As I mentioned above, there was no intention to introduce a new data model or replace Anchor Buoy (and indeed, Selector-Connector doesn’t replace it). Anchor Buoy (AB) has served me well since the graph was introduced in FileMaker 7, and even if I was going to bend some of the AB rules, I would do so as little as possible. With this in mind, I started developing the newest version of SeedCode Complete using the AB model and intended to take it as far as I could. This also had some additional practical appeal as it could lead to a clear process for “retrofitting” an existing AB solution with any new benefits that emerged. What I started with very much resembled the demo file aABChooser.FMP12 (from “Selector-Connector Example Files” here); a basic file with Contacts, Projects and Invoices. Projects would allow for multiple project contacts, so I would build the chooser there first. (more…)

jasonchryoung

Writer & Blogger

20 Comments

  • Charles Wiltgen

    I have deployed selector connector heavily in our solution but I am having a problem with gaining access to settings and other records through connector when there is no founds set. I only have this problem in instances where we are using RLA. The user and can the settings if there is a found set, a full access and see the settings if there is no found set, but an user with RLA cannot see the setting if there is no found set. the user has access to all the fields and tables required. This is putting a bit of a cramp on our programming. Has this problem come up with anyone else?

    • Tom Myers

      I just watched your deacon 2015 selector-connector talk. Well done! I work from my home office and can’t afford to go to the DevCon’s so this was great as I was able to bring myself more up to date. I had done some rudimentary coding that was similar and your talk really solidified solving the issues I was having. Is there any way I could get the SCDemoFiles. The Devcon speaker link is only available to those who went to DevCon. Thanks again.

  • JUAN DENT

    I downloaded the sample files but they don’t run – I cannot see any of the functionality, although the scripts are all there. I am using FM 13 Pro Advanced – is this the problem?

    • Jason Young

      Hi Juan,
      Unfortunately, I made these for 14 and used some 14 only features, particularly the button bars. Other than those these techniques work fine in 13. If I get a chance I’ll add/update 13 compatible versions to the download.
      Thanks!
      Jason

  • Hi Jason,
    Nice simple version of SelectorConnector! Where is the code that it is highlighting the search text on the list of found contacts. I am thinking it is in the style ‘chooser-display’. Is there some css that highlights any text that is equal to ContactSearchGlob field or something??
    Thanks!
    Cheers,
    Ben

    • Jason Young

      Hi Ben,
      We’ve actually got that in the virtual list calc itself. ContactChooser::Display.
      Cheers!
      Jason

      • Thanks! nice and simple. Forgot to check in the most obvious place. 🙂
        Cheers,
        Ben

  • Martin Crossman

    Aside from the button bars used in the demo files should this work in Filemaker 13 as well. I have been try to learn this technique by rebuilding in use a Filemaker 13 solution I have. I have been using the aABchoser file to get myself started. When I rebuild this the Contact Chooser table does not show all contacts. There are no records.

    • Jason Young

      Hi Martin,
      There shouldn’t be. but I’ve made this tough! By using the button bar for the pop-over, I’ve locked that one to 14! The limitation hadn’t occurred to me at the time as I was taking the opportunity to get familiar with new 14 stuff.
      Check the data viewer to see if the $$sc_contactIDs variable is populated. If so, then the SQL is all working and it’s something with loading the portal rows. Make sure the ContactChooser table is populated. If you’re rebuilding, that step is not obvious.
      hth,
      Jason

  • Denham Morgan

    Thank you for the demo file it is greatly appreciated. When I add a new contact from the picker it looks like it adds a row to the portal but doesn’t fill the contact info unless you leave the layout and return. Does it need to run a refresh window/portal step in the add contact script or is this something where you would have to refresh the cross join?

    • Denham Morgan

      It looks like it’s part of the hook behavior as it updates in cSelector but not the d and e files.

      • Jason Young

        Hi Denham,
        Thanks! I think I had stopped demoing the new contact at this point and didn’t bother to clean these up. I did get that working correctly in d and e and updated the download.
        They’re a bit different than c because of the way we’re doing the hook, but basically you want to make sure you get the “pop-back” from the new record before closing the pop-over, so I add a Go To Field[] (no field specified) step to the beginning of the Save New Contact script. We don’t get the pop-back until the field exit, so we want to force that to happen. We also want to add a commit step to the end of Save Selected Contact To Project/Invoice scripts.
        Thanks again!

  • Thanks for the article and sample files. Most of my use for such a picker is not to search the entire contact table, but to filter the list ( i.e. don’t show contacts already included, only the contacts for a certain company or of a certain occupation / title). I have a pdf showing my modifications to make this happen., don’t see a way to share here. Where would you inject into the process to filter the list? Just curious if there is an easier way.
    Thanks,
    Tim

    • Jason Young

      Hi Tim,
      In the sample files, we are using SQL to filter the list by name, so it would be easy to add additional filters to that SQL statement, i.e. companyID, etc.
      We’ve also got it set to show all Contacts if no filters are specified, but you’d probably want to change this if you had a lot of Contacts, or if you were going to add some additional filters like by company.
      I have found that SQL does not scale as well for large tables, so if you’re going to have a lot of Contacts, you’d probably want to get the list of IDs for the chooser a different way. In SeedCode Complete we have a Control file where we do FileMaker finds in the background and use ListOf on the IDs to get them into the global variable. I used SQL for these files to keep it simple and single file.
      hth,
      Jason

      • Hi Jason,
        Thanks it does help.
        Control File?? does this bleed over into another technology? or is it pure FM?
        Could you elaborate, “without giving away the farm”??
        Inquiring minds and all that,
        Tim

        • Jason Young

          Hi Tim,
          The “control file” is another filemaker file and comes from the idea of doing MVC (Model View Control) in FileMaker. The idea, in this context, being that you can do finds in the control file, and since it’s a separate file, it stays hidden and you don’t get any of the odd behavior that you get with offscreen windows from the same file (flashing, window restore on MS Windows). I think these control files work great with the Selector Connector model choosers, particularly since we now have the ListOf summary option. It’s easy and fast to set up a FM search in the control file and have the script return the ListOf Ids for the chooser and this is how we have it set up in SeedCode Complete.
          Here’s some articles on MVC in FileMaker you might want to check out for a deeper look: http://www.clevelandconsulting.com/category/mvc/
          hth,
          Jason

  • Greg

    Jason,
    Thank you for your further explanations on Selector-Connector.
    This article mentions a number of demo files that I cannot find under DevCon 2015 Demo Files on your download page. Have you not had the opportunity to post them?
    SCDemoFiles
    aABChooser.FMP12
    bUCChooser.FMP12
    cSelector.FMP12
    dSelectorHook.FMP12
    eSelectorFinal.FMP12

    Greg

    • Jason Young

      Hi Greg,
      They’re zipped up as one download as SCDemoFiles right below the DB2FM download. Hit me up at support@seedcode.com if you’re still having trouble getting to them.
      -Jason

Leave a Reply

Your email address will not be published. Required fields are marked *

20 Comments

  • Charles Wiltgen

    I have deployed selector connector heavily in our solution but I am having a problem with gaining access to settings and other records through connector when there is no founds set. I only have this problem in instances where we are using RLA. The user and can the settings if there is a found set, a full access and see the settings if there is no found set, but an user with RLA cannot see the setting if there is no found set. the user has access to all the fields and tables required. This is putting a bit of a cramp on our programming. Has this problem come up with anyone else?

    • Tom Myers

      I just watched your deacon 2015 selector-connector talk. Well done! I work from my home office and can’t afford to go to the DevCon’s so this was great as I was able to bring myself more up to date. I had done some rudimentary coding that was similar and your talk really solidified solving the issues I was having. Is there any way I could get the SCDemoFiles. The Devcon speaker link is only available to those who went to DevCon. Thanks again.

  • JUAN DENT

    I downloaded the sample files but they don’t run – I cannot see any of the functionality, although the scripts are all there. I am using FM 13 Pro Advanced – is this the problem?

    • Jason Young

      Hi Juan,
      Unfortunately, I made these for 14 and used some 14 only features, particularly the button bars. Other than those these techniques work fine in 13. If I get a chance I’ll add/update 13 compatible versions to the download.
      Thanks!
      Jason

  • Hi Jason,
    Nice simple version of SelectorConnector! Where is the code that it is highlighting the search text on the list of found contacts. I am thinking it is in the style ‘chooser-display’. Is there some css that highlights any text that is equal to ContactSearchGlob field or something??
    Thanks!
    Cheers,
    Ben

    • Jason Young

      Hi Ben,
      We’ve actually got that in the virtual list calc itself. ContactChooser::Display.
      Cheers!
      Jason

      • Thanks! nice and simple. Forgot to check in the most obvious place. 🙂
        Cheers,
        Ben

  • Martin Crossman

    Aside from the button bars used in the demo files should this work in Filemaker 13 as well. I have been try to learn this technique by rebuilding in use a Filemaker 13 solution I have. I have been using the aABchoser file to get myself started. When I rebuild this the Contact Chooser table does not show all contacts. There are no records.

    • Jason Young

      Hi Martin,
      There shouldn’t be. but I’ve made this tough! By using the button bar for the pop-over, I’ve locked that one to 14! The limitation hadn’t occurred to me at the time as I was taking the opportunity to get familiar with new 14 stuff.
      Check the data viewer to see if the $$sc_contactIDs variable is populated. If so, then the SQL is all working and it’s something with loading the portal rows. Make sure the ContactChooser table is populated. If you’re rebuilding, that step is not obvious.
      hth,
      Jason

  • Denham Morgan

    Thank you for the demo file it is greatly appreciated. When I add a new contact from the picker it looks like it adds a row to the portal but doesn’t fill the contact info unless you leave the layout and return. Does it need to run a refresh window/portal step in the add contact script or is this something where you would have to refresh the cross join?

    • Denham Morgan

      It looks like it’s part of the hook behavior as it updates in cSelector but not the d and e files.

      • Jason Young

        Hi Denham,
        Thanks! I think I had stopped demoing the new contact at this point and didn’t bother to clean these up. I did get that working correctly in d and e and updated the download.
        They’re a bit different than c because of the way we’re doing the hook, but basically you want to make sure you get the “pop-back” from the new record before closing the pop-over, so I add a Go To Field[] (no field specified) step to the beginning of the Save New Contact script. We don’t get the pop-back until the field exit, so we want to force that to happen. We also want to add a commit step to the end of Save Selected Contact To Project/Invoice scripts.
        Thanks again!

  • Thanks for the article and sample files. Most of my use for such a picker is not to search the entire contact table, but to filter the list ( i.e. don’t show contacts already included, only the contacts for a certain company or of a certain occupation / title). I have a pdf showing my modifications to make this happen., don’t see a way to share here. Where would you inject into the process to filter the list? Just curious if there is an easier way.
    Thanks,
    Tim

    • Jason Young

      Hi Tim,
      In the sample files, we are using SQL to filter the list by name, so it would be easy to add additional filters to that SQL statement, i.e. companyID, etc.
      We’ve also got it set to show all Contacts if no filters are specified, but you’d probably want to change this if you had a lot of Contacts, or if you were going to add some additional filters like by company.
      I have found that SQL does not scale as well for large tables, so if you’re going to have a lot of Contacts, you’d probably want to get the list of IDs for the chooser a different way. In SeedCode Complete we have a Control file where we do FileMaker finds in the background and use ListOf on the IDs to get them into the global variable. I used SQL for these files to keep it simple and single file.
      hth,
      Jason

      • Hi Jason,
        Thanks it does help.
        Control File?? does this bleed over into another technology? or is it pure FM?
        Could you elaborate, “without giving away the farm”??
        Inquiring minds and all that,
        Tim

        • Jason Young

          Hi Tim,
          The “control file” is another filemaker file and comes from the idea of doing MVC (Model View Control) in FileMaker. The idea, in this context, being that you can do finds in the control file, and since it’s a separate file, it stays hidden and you don’t get any of the odd behavior that you get with offscreen windows from the same file (flashing, window restore on MS Windows). I think these control files work great with the Selector Connector model choosers, particularly since we now have the ListOf summary option. It’s easy and fast to set up a FM search in the control file and have the script return the ListOf Ids for the chooser and this is how we have it set up in SeedCode Complete.
          Here’s some articles on MVC in FileMaker you might want to check out for a deeper look: http://www.clevelandconsulting.com/category/mvc/
          hth,
          Jason

  • Greg

    Jason,
    Thank you for your further explanations on Selector-Connector.
    This article mentions a number of demo files that I cannot find under DevCon 2015 Demo Files on your download page. Have you not had the opportunity to post them?
    SCDemoFiles
    aABChooser.FMP12
    bUCChooser.FMP12
    cSelector.FMP12
    dSelectorHook.FMP12
    eSelectorFinal.FMP12

    Greg

    • Jason Young

      Hi Greg,
      They’re zipped up as one download as SCDemoFiles right below the DB2FM download. Hit me up at support@seedcode.com if you’re still having trouble getting to them.
      -Jason

Leave a Reply

Your email address will not be published. Required fields are marked *

COMPANY

FOLLOW ALONG

Stay up to date with the latest news & examples from SeedCode

© 2024 SeedCode, Inc.