1 2 Previous Next 19 Replies Latest reply on Dec 11, 2014 8:28 AM by philmodjunk

    Filter Script

    DennisTyner

      Title

      Filter Script

      Post

      My application is based on the Contact starter solution where I have changed the Contacts Table to one called Households and I have added two additional tables one called Individuals and one called events.

      My issue is in the Individual List view where I want to select a filter value to show only records meeting the filter criteria.  The filter values are “All”, “Member”, “Former Member”, “Non-Member”, etc.  The only filter value that seems to work is the “Unknown” value.  The logic for this filter selection button is cloned from the “Household List” which has a similar filter button that is working correctly.  I attempted to insure all associated scripts where cloned with similar but distinct naming conventions from the Household List view to the Individual List view.

      If you feel you have can assist me please respond to this post and I will email you my application.   

      Any help with this problem would be greatly appreciated.

        • 1. Re: Filter Script
          SteveMartino

          I'm on my iPad and can't check this, but I think the drop down that filters your list is both based on a value list that you may need to modify, and uses a script trigger that has a script parameter.  And I think the script is hard coded with If, Else If statements.

          You could post your file with some sample data.

          • 2. Re: Filter Script
            DennisTyner

            Steve you are correct in your assessment as to the drop down filter object uses a script trigger and to the best of my knowledge I felt I had modified all relevant scripts correctly.  I have created a version of my file with test data but I'm not sure how to post my file.

            • 3. Re: Filter Script
              SteveMartino

              Easiest way is to zip it, and put it in a Dropbox Public folder.  Then right click on the zipped folder, it will say "Copy Public LInk" (or something like that).  Paste link into your post.

              I'm looking at the starter solution, but without your file, I'm just guessing.

              When you changed the script, did you go into each sort dialog and make the appropriate changes

              Go into Manage Database and look at the details for the field Sort Selection>Open 'Calculated Value'  That has to be changed there as it tests against "Contact Name". 

              Also the dropdown list gets its values from a Value list, make sure you have made the proper changes, and double check the spelling in the value list matches the spelling in your hard coded scripts.

              • 4. Re: Filter Script
                DennisTyner

                Steve, thanks again for your reply. To the best of my knowledge I have looked at all sugested scripts, value list etc. prior to mmy original post. As we speak I am at a off site training class but when I retun I will do as you instructed and put it in a drop box and post. Look for it this evening. Thanks 

                • 5. Re: Filter Script
                  philmodjunk

                  If you have not already done so, I suggest looking at this thread of scripted find examples: Scripted Find Examples

                  • 6. Re: Filter Script
                    DennisTyner

                    Steve,

                    Here is the link to the file:   https://www.dropbox.com/s/xlns6dc9kkc5y9o/LCBCtest.fmp12?dl=0

                     

                     

                     

                    • 7. Re: Filter Script
                      SteveMartino

                      Unfortunately, I'm on version 12, cant open a 13

                      • 8. Re: Filter Script
                        DennisTyner

                        Steve, thanks for trying.  I'll keep plugging away and hopefully I'll figure it out.  I've even use the debugger tools and have not found my problem.

                        • 9. Re: Filter Script
                          DennisTyner

                          I am still working on this.  I’m going to give you a brief background and description of my issue and include the two scripts used in the layout.  I selected the FileMaker Pro 13 "Contacts" Template.

                           This template has one table "Contacts".  I renamed that table to "Household" and added a child table "Individuals"  The Contacts template has a "Contacts List" layout with a button attached to a Value List which when selected allows you to select a value and the performs a trigger script.  The trigger script is "Status Filter", it then calls a second script call "Trigger | Sort Contact List [Get Script Parameter] 

                          Below is you will find the two scripts used in association with the Household List layout,  “Trigger | Status Filter” and “Trigger | Sort Contact List [Get Script Parameter]” followed by the associated value lists:

                          Trigger | Status Filter

                          Set Error Capture [On]

                          Set Field [Household::QuickFind; “”]

                          If [Individual::HouseholdStatusFilter = “All”

                             Show All Records

                          Else

                             Set Variable [$$SCRIPT_TRIGGER; Value:”Off”]

                             Set Variable [$$FILTER; Value:Household::HouseholdStatusFilter]

                          End If

                          Perform Script [“Trigger | Sort Contact List [Get Script Parameter]”; Parameter:$$PLATFORM]

                          GO TO RECORD/REQUEST/PAGE [First]

                           

                          Trigger | Sort Contact List [Get Script Parameter]

                          Set Variable [$$PLATFORM; VALUE:GET ) ScriptParameter )]

                          If [$$SCRIPT_TRIBBER = “Off”]

                             Set Variable [$$SCRIPT_TRIBBER; Value:”On”]

                             Exit Script[]

                          End If

                          If [Household::SortSelection = “Contact Name”]

                             Sort Records [Restore; No dialog]

                          Else

                             Sort Records [Restore; No dialog]

                          End If

                          Scroll Window [Home]

                           

                          Value List “HouseholdStatusFilterList”

                          All

                          Active

                          Inactive

                          Unknown

                           

                          Trigger | Status Filter 2

                          Set Error Capture [On]

                          Set Field [Individual::QuickFind; “”]

                          If [Individual::IndividualStatusFilter = “All”

                             Show All Records

                          Else

                             Set Variable [$$SCRIPT_TRIGGER; Value:”Off”]

                             Set Variable [$$FILTER; Value:Individual::IndividualStatusFilter]

                          End If

                          Perform Script [“Trigger | Sort Contact List 2 [Get Script Parameter]”; Parameter:$$PLATFORM]

                          GO TO RECORD/REQUEST/PAGE [First]

                           

                          Trigger | Sort Contact List 2 [Get Script Parameter]

                          Set Variable [$$PLATFORM; VALUE:GET ) ScriptParameter )]

                          If [$$SCRIPT_TRIBBER = “Off”]

                             Set Variable [$$SCRIPT_TRIBBER; Value:”On”]

                             Exit Script[]

                          End If

                          If [Individual::SortSelection = “Contact Name”]

                             Sort Records [Restore; No dialog]

                          Else

                             Sort Records [Restore; No dialog]

                          End If

                          Scroll Window [Home]

                           

                          Value List “IndividualStatusFilterList”

                          All

                          Member

                          Former Member

                          Non-Member

                          Former Member Deceased

                          Unknown

                           

                          • 10. Re: Filter Script
                            DennisTyner

                            Last post also should have said then followed by the two script used in association with the Individual List Layout, “Trigger | Status Filter 2” and “Trigger | Sort Contact List 2 [Get Script Parameter]” followed by the associated value lists:

                            • 11. Re: Filter Script
                              DennisTyner

                              NEVER MIND.  I FIGURED IT OUT!!!!  IT WAS IN MY PEFORM FIND [Restore].  It was still set to the Household settings.

                              • 12. Re: Filter Script
                                philmodjunk

                                I don't see any code in those lists that will modify the current found set of records such as by "filtering" them.

                                and there seems to be a glaring error in the original scripts:

                                f [$$SCRIPT_TRIBBER = “Off”]

                                   Set Variable [$$SCRIPT_TRIBBER; Value:”On”]

                                   Exit Script[]

                                End If

                                From what I see here that should be TRIGGER, not TRIBBER!!!

                                I am highly critical of one aspect of recent starter solutions: There is a complete and utter lack of any kind of documentation included with them. In my book, that's egregiously unprofessional. I would never, ever release any database file to anyone without, as a minimum, comment lines in all but the simplest most obvious scripts and comments embedded in any complex calculations. For files as complex as the starter solutions, I'd also supply some sort of written or personal documentation on both the design and the function of each layout--either on the layout itself or in some kind of associated document. Even as a developer with long experience, "reverse engineering" the design of many of these templates is very irritating and time consuming due to that lack of documentation. For someone new to FileMaker, it can be near impossible to do so and this makes modifying one of these files a very problematic undertaking.

                                • 13. Re: Filter Script
                                  philmodjunk

                                  I suggest that you refer to the thread on scripted finds that I recommended earlier. This shows an alternate method for scripting finds that keeps the criteria used readily visible in the script so that you don't end up missing such details because it's hidden inside another dialog box.

                                  • 14. Re: Filter Script
                                    DennisTyner

                                    PhilModJunk, I agree with your assessment of starter solutions documentation or lack there of.  Your reference to the "$$SCRIPT_TRIBBER = "OFF"]" was due to my hurried typing in Word since you cannot copy and past out of the Script editor.  My script was correct "$$SCRIPT_TRIGGER = "OFF"]".  My error was when I selected the "PERFORM FIND [Restore] while in the editor the value was not reveled in the window until I used the mouse to drag it into view.  The window app read to have no values initially.  Once I found the value I discovered it still set to the value from the original table and not correctly set to the new table. Anyway all is well.  Thanks for your assistance and review the thread you suggested for further use.

                                    1 2 Previous Next