7 Replies Latest reply on Jun 24, 2014 4:38 AM by bbringardner

    Structure of Multiple Finds (refining results)

    bbringardner

      I would like to create functionality which allows the user to filter a list based on the contents of the list and then further refine it based on a selecton from a second field (and a third and fourth). I have been able to do this for single single field and for multiple fields, but only when entered in a redetermined order. I would like to be able to allow the user to select up to four terms in any order. I get stuck when establishing the "Find Records" because I must indicate a specific field to search, which is okay if the order in which the finds are going to occur is predetermined, but since they are not it poses a problem.

       

      Here is an example of what I would like to do:

       

      Field1 Field2 Field3

      a c e

      a b e

      a b e

      ff b j

       

      If the user clicks on "a" in field 1 the list fileters to be:

      Field1 Field2 Field3

      a c e

      a b e

      a b e

       

      then if the user clicks on "c" in field 2 the list fileters to be:

      Field1 Field2 Field3

      a c e

       

      I would like to get the same result if they selected the same records, but in a different order as well.

       

       

      Thanks in advance!

      Ben

        • 1. Re: Structure of Multiple Finds (refining results)
          Mike_Mitchell

          Ben -

           

          I'm not 100% clear on what you're trying to do. On the one hand, it looks like you're doing a cascading value list (choice in A narrows the available choices in B, which narrows the available choices in C). But on the other hand, it sounds more like you're trying to implement a Quick Search sort of feature where you have multiple search criteria that can insert into multiple fields. Those are two different things.

           

          Can you clarify a bit?

           

          Mike

          • 2. Re: Structure of Multiple Finds (refining results)
            BruceRobertson

            If you can train yourself/your users to use the native FileMaker features, it's already available.

             

            Control-click/right-click in the target field and choose "Constrain".

             

            You can also make a simple script to do the same thing.

            • 3. Re: Structure of Multiple Finds (refining results)
              bbringardner

              I believe that I am looking for a cascading list.  I have setup a button (invisible - which triggers a script to set a variable and then perform a find in the clicked field based on the variable) over each field and am viewing the layout as a list.  The idea is that the user can click on the value that they would like to filter by in Field1 refining the list, then Field2 further refining, and finally then Field3 refining further... or in any order they wish (3,2,1 etc).

               

              The issue I have is making it so the fields can be clicked in any order.

               

               

              Ben

              • 4. Re: Structure of Multiple Finds (refining results)
                justinc

                Hey Ben,

                     I think that Bruce's idea is probably the way you want to go, but with the scripted version.

                 

                Your buttons on each column would pass a parameter to the script, defining what column was clicked.  Your script would want then run through a big IF statement that checked the value of the parameter passed in.  When it finds a match, it already knows what column it is, so reads the value from that field and sets the FIND criteria in that field to that value.  Since you are always only doing one at a time, that's all you need, really.  Then you do a CONSTRAIN.  Might look something like this:

                 

                //  Read the current value (before you enter find mode)

                if (parameter = "column1")  set $value = tableA::column1

                else if (parameter = "column2")  set $value = tableA::column2

                else if (parameter = "column3")  set $value = tableA::column3

                else if (parameter = "column4")  set $value = tableA::column4

                 

                enter find mode

                set error capture [on]

                 

                if (parameter = "column1")  set field1 = $value

                else if (parameter = "column2")  set field2 = $value

                else if (parameter = "column3")  set field3 = $value

                else if (parameter = "column4")  set field4 = $value

                ...

                 

                Constrain found set

                 

                 

                You could also pass in two parameters to the script:  the field clicked on, and the current value in the field.  That would simplify the script some what (would only have to do one logic check sequence), but make your button definitions more tricky.

                 

                --  Justin

                1 of 1 people found this helpful
                • 6. Re: Structure of Multiple Finds (refining results)
                  ChadAdams

                  Hi Ben,

                   

                  If I'm reading your request correctly it looks to me like you could use one script to do what you want.

                   

                  I'd set it so each field was a button that did the following:

                   

                  Button Click passes two parameters: Field Name and the value of the field clicked ( Field ; Text ).

                   

                  Script would be something like this;

                   

                  $fieldName = Value in your Field parameter

                  $text = Value in the Text parameter

                  $foundCount = Get(FoundCount)

                  $recordCount = Get(TotalRecordCount)

                   

                  Enter Find Mode

                  IF $fieldName = "Field A"

                       Set Field ( Field A ; $text )

                  Else IF $fieldName = "Field B"

                       Set Field ( Field B ; $text )

                  Else IF $fieldName = "Field C"

                       Set Field ( Field C ; $text )

                  End IF

                  IF $foundCount = $recordCount

                       Perform Find

                  Else

                       Constrain Find

                  End IF

                   

                   

                  You could do this several different ways with calculated field names or whether you set varialbes with the parameter data or whatever, but this was the easiest way to type it out for this mesage :-)

                   

                  Hope that helps,

                   

                  Chad

                  1 of 1 people found this helpful
                  • 7. Re: Structure of Multiple Finds (refining results)
                    bbringardner

                    Bruce - Thanks so much for the sample file.  It was really helpful, taught me a lot, and enabled me to produce exactly the functionality I was looking for.  The BIG thing that i didn't realize existed was the script parameter and I don't think that I was utilizing constrain found set correctly.

                     

                     

                    Thanks!
                    Ben