FlexSearch

by Joshua Willing

FlexSearch is Quick Find with super powers.

Sometimes Quick Find isn’t enough. Because it matches phrases from the beginnings of words it can miss valuable search results. Performing a Find is the natural response but many users find that process awkward.


FlexSearch solves this problem! It is a portable search bar that performs a Quick Find or “FlexSearch”, which matches phrases using the beginnings, middles and ends of words too. Users can easily turn FlexSearch on and off, or the developer can incorporate just one or the other.


FlexSearch is fast. For hosted files it actually outperforms Quick Find when searching long phrases because it performs the complex find on the server and replicates the found set on the client.

Dependencies

Hyperlist is required. The example file below contains Hyperlist so you can copy it from there if you don’t have it yet.

 

Download:

Download Module Version 1.0.3

 

In the installation video below, please disregard the part that says UUIDs are required. The latest version works with any kind of id, including serial numbers.

Videos:

Intro

Installation

Suggestions welcome!

 

Version History:

  • 1.0.1. — 5-29-2017 — Adjusted the hide calculation in the flexsearch fields offscreen object to accommodate single field flexsearches. Thanks pleiades for pointing out the bug.
  • 1.0.2 — 6-7-2017 — rgordon pointed out that the module was creating 3 TIMES as many search records as needed. This should work even faster now. Thanks rgordon for the insight!
  • 1.0.3. — 8-6-2017 — Flexsearch now works with serial numbers instead of just UUIDs. Any id type will work as long as the id is unique within its own table.

22 responses to “FlexSearch”

  1. rlanthier says:

    Hi Joshua

    Very nice tool and easy to install.

    Can it work in a portal?

    rl

    • Joshua Willing Halpern says:

      Hey, glad you found it useful! Currently this does not filter portals, but I suppose a future version should do that.

  2. Shannon says:

    Nice!

  3. pleiades says:

    Hi Joshua!

    Would it be possible to put it in pop-up picker?
    https://filemakerhacks.com/2011/05/09/popup-pickers/

    I like to suggests flexsearch popup module for portals

    TIA!

    • Joshua Willing Halpern says:

      I haven’t tested it this way, though I’m sure it could be made to work if it doesn’t already! I’ll take a look when I have a free moment. And thanks for the article, I’ll have to check it out soon.

    • Joshua Willing Halpern says:

      Hey, I just opened the article you sent about popup pickers. I believe you should be able to install it on a popup picker already with no changes to the module. Simply create your picker layout, a button to open the picker, and a button on the list row to choose the record you want.

  4. _cato_ says:

    Hi Joshua,
    just tried your tool – good job! Easily implemented und fast!

    I have a little suggestion for the ScriptParameter that’s needed to start the search: Get(LayoutName) & “::id”
    So you can copy and paste the searchbar without having to adjust the ScriptTrigger.

  5. _cato_ says:

    Supplementary note to my previous post: I know – my suggested ScriptParameter only works, when the id field in every table is named “id”. And it breaks, if someone changes the name of an id field.

    But if you use consequently the same name for the id field, it’s less work to implement FlexSearch.

    • Joshua Willing Halpern says:

      I was going to say the same thing. I originally wanted to avoid script parameters altogether, and your method all but eliminates the hassle of having them. Good idea. Thanks for clarifying the risk of hardcoding the field name to anyone who might have missed that.

  6. pleiades says:

    Thank you for the reply Joshua!

    Hope you can make one for line items, it would make adding product to invoices very quick. Thank you!

    @_cato_
    I like to learn more of your technique, is the “id” the foreign or primary key? what if you have joins? do you need to rename them all to id?

    sorry, I’m learning filemaker on my spare time.

  7. _cato_ says:

    First of all, I have to correct myself: It would be better to use Get(LayoutTablename) & “::id”, because layout name and layout table name could be different … then Get(LayoutName) would not work to address the table of the actual layout.

    @pleiades
    All primary key fields in a solution should have the same name.

    I always name primary key fields in every table of my solutions “id” – like descripted here: http://filemakerstandards.org/display/cs/Naming+Conventions

    For foreign key fields I use the pattern “id_NameOfTheForeignTable”.

    This way you know in every context where to find the id and where to find the foreign id.
    Hope, this helps you a little bit …

  8. Byeng Han yoo says:

    hi. joshua!
    can i ask u about something?
    i always use invoices of filemaker Pro advanced. it is inconvenient to popover search in Add Line Item.
    I think flexsearch is better than the basic popover search.
    Is it possible to put flexsearch in instead of the basic popover search?
    IF it is possible, Please make it

    • Joshua Willing Halpern says:

      Hi Byeng,
      FlexSearch is designed to find records within lists and forms rather than filter portals like in the Invoice Starter Solution (to which I believe you’re referring). If you want to incorporate FlexSearch into your Add Line Item workflow, I recommend you make a Card Window picker layout with flexsearch on top. Base this layout on your products table and configure as you would normally configure flexsearch to search only the fields you want/need.

  9. plei says:

    Hi Joshua!

    The flexsearch module uses the guid using Get (GUID), I would like to connect it with an external database (MySql and MSSQL), the data in the external database are not editable and i cannot added another column for guid,

    Would it be possible to allow flexsearch to use other fields of the external database like a serial number if there is no guid?

    Thank you!

    • Joshua Willing Halpern says:

      Hey plei, I’m pretty sure you need to use UUIDs(GUIDs) if you intend to use the “FlexSearch” feature on a hosted file and not just the regular quickfind option. Look in the example file relationship graph in the green box. This is where you would put your searchable tables and when Flexsearch does a server-side search, it’ll scan these TOs when it gets back client-side to recreate the found set. Since serials can be duplicated over multiple different tables (e.g. table1,id1 and table2,id1) the script will not know which table to use.

      However, you’ve just given me an idea for an improvement that would do just that. If you want to do a modification that fixes this problem by all means, go ahead. Otherwise I will when I have some spare time in the future.

    • Joshua Willing Halpern says:

      Hey, the new version 1.0.3 will work with serial numbers (or any id type) as long as the id is unique within the table. Cheers!

  10. Peter says:

    Hi Joshua

    Just like to say thank you! – Very easy to install and use, and have obviously saved me a lot of time.

    Cheers
    Peter

  11. Joshua, first of all… thank you for this. Easy to install, works like a charm.
    Is there a way to limit the search to a subset? For example: Let’s say I have a list of contacts that reside in multiple cities across the country. Can I search for people named ‘Smith’ that have New York as a city in their address (where ‘city’ is a field)? So while I have 10 people named ‘Smith’ nationwide, I might have only 3 from New York.
    Thank you again for this wonderful module.

    • Joshua Willing Halpern says:

      Hi Lazarus, you’re welcome, I’m glad that you are finding this useful.
      As long as the module is searching the city field too, simply type “Smith New York” and you should get your desired result.

  12. The “City’ was an example (I guess it failed as such). I actuality it’s limiting the set by matching a field that has a particular UUID ( not the main ID ) – it’s a foreign key field. So, it’s searching the set constrained by a predetermined foreign key – or even better constrained by a variable that can be passed through.
    Thank you again.

    • Joshua Willing Halpern says:

      I understand now that you want to pre-filter by a certain field automatically, with no user interaction. This module does not currently support this but it would be an easy feature to implement. I’d pass in an array of JSON objects {fieldName, value, omitBoolean} which would be converted into find requests by the scripts. These would further filter any results returned. I don’t have time to implement this feature right now but it would be a very good addition for a future version.

Leave a Reply

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