10 Replies Latest reply on Oct 1, 2013 10:47 AM by dougfsm

    Filter portal based on radio button

    beretta819

      Hi everyone,

      I am really new to FM and I am stuck. So... I have a contacts layout with a portal looking into a roles table which shows me all records related to the contact. There is a "Active" checkbox in the roles table.

       

      I am trying to set up a portal filter based on a radio button on the contacts layout that says "Active Only" or "All".

       

      I used a case statement to show only the records in the roles table that say "is active". That worked! I am stuck at then making the filter show all of the records. The table column can contain "active" or can be empty.

       

      This is what I wrote into the filter dialog:

      Case(

      Contacts::Contact_Active_Option = "Active Only"; Roles::Roles_Active = "Is Active";

      Contacts::Contact_Active_Option = "All"; Roles::Roles_Active = "Is Active" and "";

      )

       

      The first statement works, the second does not. So, when the user clicks the "All" option it should show the records with "Is Active" and the records that are empty.

       

      Thanks for any suggestions you may have.

        • 1. Re: Filter portal based on radio button
          LyndsayHowarth

          You can do this by relationship.

           

          On the LHS you have a field which is your radio button (global) on the RHS you have a field for status. That field calculates "All" in all records and "All¶Is Active" in those which are active.

           

           

          HTH

           

          - Lyndsay

          • 2. Re: Filter portal based on radio button
            beretta819

            Thanks for the quick response...

             

            So I did as you explained and made it work, sort of. The results in the portal now match the records where the global is equal to the status, but the records are not equal to the related records for that contact. The original relationship between the Contacts and Roles is many to many and related through a join table. (LHS > ContactID - RHS > RoleID - Join > ContactFK - RoleFK)

             

            How should I set up the relationship so the portal only shows the related records?

             

            - Marc

            • 3. Re: Filter portal based on radio button
              taylorsharpe

              You could base the portal on the related table occurrence or you could use portal filtering. 

              • 4. Re: Filter portal based on radio button
                debi

                Marc,

                 

                I think you can keep your original relationship (it sounds like that part is using the contact key), just change your filter calc to:

                Case(

                Contacts::Contact_Active_Option = "Active Only"; Roles::Roles_Active = "Is Active";

                Contacts::Contact_Active_Option = "All"; 1

                )

                or just

                Case(

                Contacts::Contact_Active_Option = "Active Only"; Roles::Roles_Active = "Is Active";

                1

                )

                 

                You had:

                A - Roles::Roles_Active = "Is Active"

                and

                B - ""

                A and B BOTH need to evaluate to 1 (true) for their combination to be true.

                 

                Roles::Roles_Active = "Is Active" OR Roles::Roles_Active = ''' would also work; notice that both part are full statements that could stand on their own.

                 

                Does that help?

                 

                Debi Rubel

                FullCity Consulting

                • 5. Re: Filter portal based on radio button
                  LyndsayHowarth

                  Just add another match field in the relationship. It could be Contact ID or it could be another unique match like Full Name & Company or Phone Number or such...

                   

                   

                  - Lyndsay

                  • 6. Re: Filter portal based on radio button
                    beretta819

                    Thank you all for your time. I was able to make the original setup work with debi's help.

                    • 7. Re: Filter portal based on radio button
                      tflannery

                      This helped me!  Had similar problem.  Am a newbie too.  Thank you.

                      • 8. Re: Filter portal based on radio button
                        dougfsm

                        I have a similar situation to the original poster.

                        I have a layout of Clients and then a portal which shows their scheduled Sessions. I am trying to use a radio button to hide or show outdated sessions.

                        Here is what I have as my filter:

                         

                        Case(

                        Client::HideOutdatedSessions = "Hide"; Session::SessionDate  ≥ Get ( CurrentDate);

                        1

                        )

                         

                        The actual filter works if I use it without the Case statement but I can't seem to get it to work based on the radio button.

                         

                        Any help would be greatly appreciated.

                         

                        -Doug

                        • 9. Re: Filter portal based on radio button
                          erolst

                          If the actual calculation works, then this is probably a refresh issue. Create a script "Refresh" with only the Refresh step, and use it as OnObjectModify trigger for your toggle field.

                           

                          btw, if you create a value list with just the value 1, redefine your toggle field as number, and format it on the layout as a checkbox with that value list, then (getting at it …) you only need to display one box (not two radio buttons); also your calculation can be more concise, since you query your field as a Boolean value, where 1 = true, empty = false:

                           

                          Case(

                            Client::HideOutdatedSessions ;

                            Session::SessionDate  ≥ Get ( CurrentDate) ;

                          1

                          )

                          • 10. Re: Filter portal based on radio button
                            dougfsm

                            That was it. Just needed to refresh. I also changed it to a single check box as you suggested.

                            Thank you so much!