4 Replies Latest reply on Dec 18, 2014 2:15 AM by GrahamKeogh

    Multiple Filters from a Drop Down

    GrahamKeogh

      Title

      Multiple Filters from a Drop Down

      Post

      Hi all

      Okay this has me totally stumped. I have tried everything suggested and read through the forum but my limited knowledge of Filemaker scripts and filters has got me nowhere.

      I have a 'Jobs' table with an input page and a list view layout. At the top of the Jobs List view layout I would like to have drop down menus that will filter out results from the list and display the associated data.

      The problem is there is quite a few variables involved that I need to sort and to get to interact. I need to have a drop down called 'Job Status' with various states of a job and will show only those selected from the list, e.g. 'Active'; then a drop down list containing employees so you can display the jobs that a person is working on; and finally a drop down that has a list of all clients to display only the jobs associated with that selected client from the list.

      I don't know how to go about getting them to all interact, so essentially you could have a situation where you could see 'active' jobs that 'Joe Bloggs' is working on for 'Acme Co'.

      If anyone can point me in the right direction I would massively appreciate it, as if I can get this sorted my other filter problems regarding a similar situation on a Timesheets table might get solved!

      Cheers

        • 1. Re: Multiple Filters from a Drop Down
          philmodjunk

          Set up a global field for each of those scripts. Either put a find button next to them to perform a script or set up OnObjectModify or OnObjectSave triggers on all of them to perform the same find script that uses the data from the global fields to set up and perform the find.

          See this thread for examples of using data entered by the user into global fields as find criteria: Scripted Find Examples

          • 2. Re: Multiple Filters from a Drop Down
            GrahamKeogh

            Brilliant thanks a million for that. After reading through, I came up with these scripts (one for each dropdown), but they are a bit Frankenstein I admit and aren't perfect, in that they don't always work correctly... Please go easy on my limited scripting skills!

            Ideally it would be great if I could get one to filter via the other, i.e. filter for designer Jane Doe, then using another dropdown filter for the active jobs they are working on. However at this stage any solution will do me, even if it's three find buttons.

            ACCOUNT MANAGER:

            If [ $$SCRIPT_TRIGGER = "Off" ]
            Set Variable [ $$SCRIPT_TRIGGER; Value:"On" ]
            Exit Script [ ]
            End If
            If [ Get ( SystemPlatform ) = 3 ]
            Show/Hide Toolbars
            [ Hide ]
            End If
            If [ /*Jobs::Sort Account Manager = "All"*/ ]
            Show All Records
            Else If [ /*Jobs::Sort Account Manager ="John Doe"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else If [ /*Jobs::Sort Account Manager = "Tom Thumb"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else If [ /*Jobs::Sort Account Manager = "Bill Bunn"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else
            Sort Records [ Keep records in sorted order; Specified Sort Order: ascending ]
            [ Restore; No dialog ]
            End If
            Scroll Window
            [ Home ]

            DESIGNER LIST:

            If [ $$SCRIPT_TRIGGER = "Off" ]
            Set Variable [ $$SCRIPT_TRIGGER; Value:"On" ]
            Exit Script [ ]
            End If
            If [ Get ( SystemPlatform ) = 3 ]
            Show/Hide Toolbars
            [ Lock; Hide ]
            End If
            If [ /*Jobs::${Sort Designer Developer} = "All"*/ ]
            Show All Records
            Else If [ /*Jobs::Sort Designer Developer ="Gary Keu"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else If [ /*Jobs::Sort Designer Developer = "John Doue"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else If [ /*Jobs::Sort Designer Developer = "Jane Peter"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else If [ /*Jobs::Sort Designer Developer = "Harry Hogan"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else If [ /*Jobs::Sort Designer Developer = "Gareth Doyle"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else If [ /*Jobs::Sort Designer Developer = "Daragh McGarry"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else
            Sort Records [ Keep records in sorted order; Specified Sort Order: ascending ]
            [ Restore; No dialog ]
            End If
            Scroll Window
            [ Home ]

            JOB STATUS:


            If [ $$SCRIPT_TRIGGER = "Off" ]
            Set Variable [ $$SCRIPT_TRIGGER; Value:"On" ]
            Exit Script [ ]
            End If
            If [ Get ( SystemPlatform ) = 3 ]
            Show/Hide Toolbars
            [ Show ]
            End If
            If [ /*Jobs::Sort by Status = "-"*/ ]
            Show All Records
            Else If [ /*Jobs::Sort by Status = "Active"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else If [ /*Jobs::Sort by Status ="Active-Repeat"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else If [ /*Jobs::Sort by Status = "Closed"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else If [ /*Jobs::Sort by Status = "Hold"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else If [ /*Jobs::Sort by Status = "Quote"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else If [ /*Jobs::Sort by Status = "To be Billed"*/ ]
            Show All Records
            Constrain Found Set [ ]
            [ Restore ]
            Else
            Sort Records [ Keep records in sorted order; Specified Sort Order: ascending ]
            [ Restore; No dialog ]
            End If
            Scroll Window
            [ Home ]

             

            • 3. Re: Multiple Filters from a Drop Down
              philmodjunk

              I would use one script for all of the drop downs that uses one set field step for each global field.

              What you have in your sample script does not match my examples at all. You won't see a single [Restore] in any of the sample scripts shown in that thread.

              • 4. Re: Multiple Filters from a Drop Down
                GrahamKeogh

                Yeah I went back to the drawing board and followed those examples, works a charm now! Thanks a million!