10 Replies Latest reply on Nov 16, 2010 2:56 AM by LiamCarter

    Search in list view

    LiamCarter

      Title

      Search in list view

      Post

      Hiya All,

      Heres my problem.
      I have a list view for Orders:
      I have 9 collums.
      i would like two drop down boxes at the top.
      and when changed the i would like the following to happen:

      1st box called EN_FILTER_STRING (global text)
      2nd box called EN_FILTER_STRING_Status (global text)

      if a value is selected from the first box then only vaules with that data fronm the "Stage" collum is shown
      if a value is selected from the second box then only vaules with that data fronm the "Status" collum is shown

      Example
      1st box ADMIN is selected then the list only shows the data with ADMIN in the Stage collum
      if the 2nd box is changed to OPEN then only data with the Stage as ADMIN and the Status as OPEN will show.

      Just one more small thing i dont want to show and items where the status is set to completed unless i tick a box

      Thanks for your help in advance

      Regards

        • 1. Re: Search in list view
          philmodjunk

          You need a script for this. Each "column" in FileMaker is a Field in your table. The script can use the data in your two global fields to perform a find (and sort) for the data you want. You can place a button next to your two fields to perform this find when clicked or you can use a script trigger that runs the script when a user exits either global field.

          I had to guess at a few details and you'll need to use your field and table names in place of mine in some places:

          Enter Find Mode [] // clear the pause check box
          Set Field [YourTable::StageField ; YourTable::EN_FILTER_STRING]
          Set Field [YourTable::StatusField ; YourTable::EN_FILTER_STRING]
          New Record/Request
          Set Field [YourTable::StatusField ; "Completed"]
          Set Field [YOurTable::YourCheckboxField ; "=" ]  // specifies that "tick a box" field is empty
          Omit Record // in find mode this is the same as clicking the omit button when doing a manual find
          Set Error Capture [on] // Disables the "no records match..." dialog that will interrupt the script if no records are found
          Perform Find[]
          Sort [ No dialog ; Restore ] // use to sort your records if you need them in a particular order.

          • 2. Re: Search in list view
            LiamCarter

            Ok Cool,

            before i try this let me try and explain a little more.

            i have two drop down boxes

            Status

            Cat

            i need Stauts to filter Status and Cat to filter Cat on a AND basis so they should both apply not just one

            Status v   Cat v
            ID Name Status Cat Total
            1 Jon Open Admin 1.25
            2 Paul Completed Admin 52.36
            3 Mike In Progress Admin 52.41
            4 James Open Sales 12.36
            5 Jim Completed Sales 56.96
            6 Ben In Progress Sales 129.99

            Here is an example of "OPEN" selected

            OPEN v   Cat v
            ID Name Status Cat Total
            1 Jon Open Admin 1.25
            4 James Open Sales 12.36

            Here is an exaple of "ADMIN" selected

            Status v   ADMIN v
            ID Name Status Cat Total
            1 Jon Open Admin 1.25
            2 Paul Completed Admin 52.36
            3 Mike In Progress Admin 52.41

            Here is an example of both "ADMIN" and "OPEN" Selected

            OPEN v   ADMIN v
            ID Name Status Cat Total
            1 Jon Open Admin 1.25

            So i change Status to "OPEN" and only 1 and 3 is shown

            If i leave status on "OPEN" and change cat to "ADMIN" then only ID 1 is shown

            if i then change Status to nothing or * then ID's 1, 2, 3 are show because "ADMIN is still selected

            I hope this clears things up

            Regards

            • 3. Re: Search in list view
              philmodjunk

              That's exactly how the script should work. Contents of both the global fields are entered into the same find request and thus this is an AND specification.

              The subsequent request is an "omit" request so that "i dont want to show and items where the status is set to completed unless i tick a box" works as you specified in your original post.

              Have you tried out the script to see if it works?

              • 4. Re: Search in list view
                LiamCarter

                The script for the search works a treat.

                Thank you, Now just the completed box. I have created a checkbox with a value list of just completed.

                When i view the page i have no completed at all and the checkbox never get "ticked" as such the cros just dissapears as soon as i tick it.

                Regards

                • 5. Re: Search in list view
                  philmodjunk

                  "When i view the page i have no completed at all and the checkbox never get "ticked" as such the cros just dissapears as soon as i tick it."

                  That's very strange and isn't typical FileMaker behavior for a check box formatted field.

                  How exactly did you define and format your checkbox field?

                  • 6. Re: Search in list view
                    LiamCarter

                    Inspector image 1Inpector 2Inspector 2

                    Vaule

                    Script

                    I hope the images help better than an explination.

                    Many Regards

                    • 7. Re: Search in list view
                      philmodjunk

                      Is EN_Completed a field of type Text or some other data type. (Open Manage | Database | Fields and check the field definition.)

                      • 8. Re: Search in list view
                        LiamCarter

                        EN_Completed-Text-Global

                        Regards

                        • 9. Re: Search in list view
                          philmodjunk

                          En_Completed should not be global in order to be used in this script as written. I assumed that you wanted to find records where this value was selected. I see instead that you want to be able to turn this option on or off for your find.

                          Change your script like this:

                          Enter Find Mode [] // clear the pause check box
                          Set Field [YourTable::StageField ; YourTable::EN_FILTER_STRING]
                          Set Field [YourTable::StatusField ; YourTable::EN_FILTER_STRING]
                          If [IsEmpty ( Orders::EN_Completed) ]
                             New Record/Request
                             Set Field [YourTable::StatusField ; "Completed"]
                             Omit Record // in find mode this is the same as clicking the omit button when doing a manual find
                          End If
                          Set Error Capture [on] // Disables the "no records match..." dialog that will interrupt the script if no records are found
                          Perform Find[]
                          Sort [ No dialog ; Restore ] // use to sort your records if you need them in a particular order

                          • 10. Re: Search in list view
                            LiamCarter

                            Thanks this was great help.

                            You are a star, and sorry for the late response

                            Regards