Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Search Button based on a Dropdown Menu, is it possible?


This topic is 4363 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi, I have a field "class" on my DB which gives a choice of values based on a value list in the form of a dropdown list say A,B,C,D,E I would like to add a button with a dropdown, the user selects "A" from the list and FMP gives him only the records which have "A" chosen in the dropdown list related to the corresponding value list taken from the field "class". Would that be possible? Would that involve heavy scripting? How could I achieve that?

Thanks in advance for the help.

Posted

Read up on FIND. The user would simply find all records with "A" in the field.

Posted

As bcooney said, use a Find. Since you are using FM12, set a OnObjectModify script trigger on the drop down field. In the script, simply execute a find to get the records that match the value selected in the drop down list.

  • Like 1
Posted

So if I understood correctly... I duplicated the "class" field and put it on the header, on it I set a OnObjectModify script trigger created a find script and... how do I tell the script to pick the value that the user selected? Sorry for asking but I am pretty new at scripting. (sample attached)

P.S. I know that this whole thing could be solved if the user performed a find and clicked the value himself but I aim to simplify things even further to my users if possible and a big bright button sounds about right.

test.zip

Posted

Do not use the class field itself for the search popup, because this would modify your existing data, i.e. a selection in the popup would change the value in the field class of the first currently active record, probably not what you want (let alone that you could't perform a search if no record is active). Instead, use a dedicated global field (a field defined with global storage) as search field.

If you searching for values from a limited domain, use a popup menu, not a drop-down list, to prevent your users from entering arbitrary values.

You can define a dynamic value list that holds all unique values from the class field; use this value list for the search popup, and you'll always find at least one record.

Define a serial number field (aka primary key) in each of your tables, so you can uniquely identify each record. As soon as you create relationships, you'll need it.

PopupSearchField.fmp12.zip

  • Like 1
Posted

Thank you very much, it worked like a charm and in the process I also learned something new.

  • 3 months later...
  • Newbies
Posted

Great thread, thanks for everyone's contribution! I have an additional question. I am using EOS's solution for a Popup menu in the header of my layout filtering the data (and some charts) in the body of the layout. I even expanded the script so I can have three connected popup menus to filter data by adding a few more gSearch** fields to my table and Set Field commands to the script.

I do have two problems.

1) I have filters where I would really like to be able to multi-select filtering criteria. I don't believe that the popup function allows this in FMP, so I will likely have to use a checkbox set. Not as great w respect to UI, but a necessary functionality. I think my current code cannot handle a multiple set of values in the variable, perhaps an array function?

also

2) Either in a checkbox set or a popup menu, I need to be able to have the "- ALL-" option in the value list to either a] nullify the Set Field Command for that particular find criteria (I'm thinking an IF statement) or b] have the "- ALL-" option to select all possible values.

Thanks in advance for your help!

post-107622-0-64770000-1350864396_thumb.

Posted

It is my experience that using global fields and triggers to find becomes limiting. Great if you have one filter. Once the find requirements become unwieldy and perhaps unpredictable, imho, it is best to provide a Find layout. For example, the above "All" option. Not needed. Just don't enter search criteria in the field.

  • 1 month later...
Posted

EOS, thanks for the file.

 

The [enter find mode] script step seems clunky to me. I feel the [perform find] should be more robust and at least accept variables! You can set static info like "Due" but not a variable like used in EOS's demo. Custom values list are no problem, you could always add an "all" in the list or whatever. But when using values from a table field, "All" is not an option... at least to my knowledge, maybe some fancy, super brain developer has a trick for this.

 

bcooney... did you say "another layout"... lol, filemaker and its freaking layouts!!! A full solution has SOOOOO many layouts it's ear bleeding to make any graphic changes across the board.

 

I have found in the very small group that I've tested with, that in my solution anyways, that the User prefers the search bar (kinda like the one in eos's demo) for common/often searches such as "Open Projects" and "Due Invoices". But uses FileMaker's find mode for less often/more complex searches like projects with "meatballs" in title.

 

I use a layout just for finding when creating a new client or contact record... a governed script that prevents duplicates.

 

Cheers!

This topic is 4363 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.