11 Replies Latest reply on Oct 2, 2014 5:51 AM by SkipGilleland

    Filter List view with two fields

    SkipGilleland

      Title

      Filter List view with two fields

      Post

      I am trying to filter my "List View" by Group (GroupFind) and all records where "ΩCurrentEvalNumber" greater than or equal to 5.  I want to be able to choose a number from the dropdown in "GroupFind" and when I click the "Hide completed" button it will not display all the records that have the "ΩCurrentEvalNumber" 5 or greater.

      The attached image has the script that is on the "Hide Completed" Button.  

      When I click the button, all the records are hid on my view.

      Document4.png

        • 1. Re: Filter List view with two fields
          SkipGilleland

          Is there any other way to do this?

          • 2. Re: Filter List view with two fields
            philmodjunk

            The Second set field step needs to be:

            Set Field [Players_Skills::CurrentEvalNumber; ">5" ]

            What you have is a Boolean expression comparing the value of CurrentEvalNumber to the number 5. Since you are in find mode, this field is empty and the result is False which evaluates as 0 in this context. So your current script is searching for all records with the specified GroupFind value in CourtGroupAssignment and the number 0 in the CurrentEvalNumber field.

            Note: Left out the greek character (omega?) to save time copy/pasting that character into the field name text.

            • 3. Re: Filter List view with two fields
              SkipGilleland

              I made that change and it doesn't seem to work.  One thing I forgot to mention is that on the "GroupFind" field (above image in previous post), I have that field with "Set Script Trigger" and the trigger looks like this (see image).  Not sure if this is what is causing it not to work??

              • 4. Re: Filter List view with two fields
                philmodjunk

                That script has no impact on what you see when you click the "Hide Completed" button. The error, as I pointed out in my last comment, lies in that script not the one you now post here. I am assuming, however that the Player_Skills::GroupFind field is defined to be a field with global storage. both scripts that you've posted here will fail if this is not the case.

                it doesn't seem to work.

                That's a bit vague. If you can describe the exact, incorrect results that you got when you tried to implement the change I recommended, that might provide a clue. And you might temporarily remove or disable the "Set Error Capture" script step as the error message returned if no records are being found can also reveal possible issues.

                • 5. Re: Filter List view with two fields
                  SkipGilleland

                  Yes, Player_Skills::GroupFind is a global field.  Sorry about the vagueness...when I click the button absolutely nothing happens.

                  Would it be easier to have a dropdown or a toggle switch that would show all fields that have a value of < 5?  If so how could I do that?

                  • 6. Re: Filter List view with two fields
                    philmodjunk

                    I don't see how that would be easier. This is a very simple script once all the details are correct. And your script finds records, not fields. Try this test: Remove or disable the Set Error Capture step. Run the script and report back what error message, if any, appears.

                    You can also run the script, then select Modify last find to return to find mode and check to see what find criteria was actually entered into the fields by the script.

                    And posting a copy of your newly modified script would also be helpful.

                    • 7. Re: Filter List view with two fields
                      SkipGilleland

                      I have disabled the Set Error Capture...ran the script and nothing happens.

                      I have attached a screen shot of the Current Script, and the view of "Modify Last Find" (top two images)

                      After some thought, I think that it would make the most sense to create a filter (dropdown) next to the Group Find that would allow the user to determine whether they wan't to see all of the players in a specific Group, or just the players that haven't completed all of the evaluations.  Then I could leave the "Show All" button...this button would show all of the player in all of the groups and still be able to look filter them by who have been completed (evaluated 5 times)

                       

                      • 8. Re: Filter List view with two fields
                        philmodjunk

                        And what did you see when you selected "modify last find" from the records menu?

                        Details can be important. It should be ">5", not "> 5".

                        also, your CurrentEvalNumber field needs to be of type number or a calculation field with Number as it's result type. You may not get the expected results if it's of type text.

                        Can you do a manual find using >5 as search criteria in this field?

                        If you have FileMaker Advanced, you might run this script in a script debugger to check and see if this script is tripping a script trigger and another script then runs and produces the unexpected result.

                        • 9. Re: Filter List view with two fields
                          SkipGilleland

                          When I selected "Modify Last Find" from the records menu, I see what the top image shows....nothing in in the orange circle (Which is the "Group" and a ?/5 below that.  The ?/5 is how many evals out of 5 have been performed (ΩCurrentEvalNumber).

                          The second image is what happened after I made the change from "> 5" to ">5".....

                          I think that my issue is with "Set Field [Players_Skills::CurrentEvalNumber; ">5" ]".  The Players_Skills::CurrentEvalNumber is automatically incremented anytime a eval is done.  I want to be able to hide the record anytime that field contains a value of 5 or greater.  Just guessing that my logic may be wrong here...as you can tell I am new to this! :-)  I really appreciate your help.

                          • 10. Re: Filter List view with two fields
                            philmodjunk

                            The layout makes it hard to see what criteria actually made it into your fields and I'd need to see a post or screen shot of your actual script to check picky details.

                            If you enter find mode and manually select a group, enter ≤5 into the CurrentEvalNumber field on this layout and then perform the find, do you get the records you expect?

                            • 11. Re: Filter List view with two fields
                              SkipGilleland

                              Thank you...it is now working!  entering the values in the view of "Modify Last Find" helped a great deal!  I have attached my final script for anyone that may need it as an example.