4 Replies Latest reply on Jan 29, 2017 3:36 PM by Wicktor

    Automatic filter records by various fields

    Wicktor

      Hello everyone,

      I am trying to reproduce a situation similar to many web site but without using a web viewer: I wish to filter records based on 4 (or more) different variables chosen by the user.

       

      For example the 4 fields (dropdown lists or radio buttons  each with a different value list) would give a list of values.

      Field_A: Gender (M or F)

      Field_B: Location (list of locations)

      Field_C: Age Group ( list of age groups)

      Field_D: Sport (list of sports)

      By choosing one or more options from the above, the list of records should be automatically updated.

      For example, selecting Genfer = "M" and Age Group = "15-20" the list of records would be automatically filtered by those parameters, then selecting also Sports = "Volley" the list would be even more restricted.

       

      Thanks for any advice,

      Victor

        • 1. Re: Automatic filter records by various fields
          wimdecorte

          If you are in a list then you would do straightforward finds every time the user updates one of the filters.

           

          If you are showing the choices in a portal then it will come down to constructing the correct portal filter display calc.

           

          Which of the options applies to you?

          • 2. Re: Automatic filter records by various fields
            Wicktor

            Hi wimdecorte

            I will show records in a list.

            I tried to attach a trigger script to each value list, it works but not considering the values of the other 3 value lists.

            I guess I need to find a way to filter using more than a value list variable.

            • 3. Re: Automatic filter records by various fields
              wimdecorte

              Post the script that you attached to the value list and we can start from there...

              • 4. Re: Automatic filter records by various fields
                Wicktor

                wimdecorte

                I think I have made something working.

                 

                The trigger script attached to each of the 4 filter values is a concatenation restrictions.

                (Table_A is the main Table with athlete's personal data and Table_B is the related table with events and performances)

                 

                Show All Records

                if (Table_A::Sport ≠ ""

                   Set Variable $filter; Value: Table_A::Sport

                   Constrain Found Set [Restore]   ->   which is Find Records Table_A::Sport [=$filter]

                End If

                if (Table_A::Gender ≠ ""

                   Set Variable $filter; Value: Table_A::Gender

                   Constrain Found Set [Restore]   ->   which is Find Records Table_A::Gender [=$filter]

                End If

                if (Table_A::Location ≠ ""

                   Set Variable $filter; Value: Table_A::Location

                   Constrain Found Set [Restore]   ->   which is Find Records Table_A::Location [=$filter]

                End If

                if (Table_B::AgeGroup ≠ ""

                   Set Variable $filter; Value: Table_B::AgeGroup

                   Constrain Found Set [Restore]   ->   which is Find Records Table_B::AgeGroup [=$filter]

                End If

                 

                The above seems to work.

                What do you think ?

                1 of 1 people found this helpful