1 2 Previous Next 17 Replies Latest reply on Jan 22, 2013 4:40 PM by EP

    Portal Filtering- Changing filter with Radio Buttons?

    EP

      Title

      Portal Filtering- Changing filter with Radio Buttons?

      Post

           Currently I have the same portal appearing in 4 tabs.  Each tab contains the same portal with a different filter.  Is there any way to store the filter calculations within each radio button value (maybe via a script trigger) so that I can just display 1 portal and users can use radio buttons to change the filter?

           Thanks

        • 1. Re: Portal Filtering- Changing filter with Radio Buttons?
          raybaudi

               Yes, it is possible.

               1) Create a new custom* value list, each value with your current four filter calculations.  
               2) Create a global text field ( FILTER ), format it as radio buttons with values from the above value list
               3) Filter the portal by calculation:

               Evaluate ( YourTable::FILTER )

               4) attach a trigger OnObjectModify to the radio buttons field that does a simple: Commit Records/Requests

          *Of course, the value list can also be generated by the field of a specific table

          • 2. Re: Portal Filtering- Changing filter with Radio Buttons?
            philmodjunk

                 There are a number of ways to do this. The best option depends on how each of those portals differe for each other.

                 And there can be refresh issues where modifying the readio button field's value fails to update what records are shown in the portal unless you:

                 1) incorporate the filter field in the relationship so that no filter expression is needed

                 2) incorporate the filter field in the relationship with the X operator so that changes to this field "force" and update.

                 3) A script uses refresh window [Flush Cached Join Results] to make the portal update. This last option is one best avoided, though it can be useful during development to help diagnose portal refresh issues.

            • 3. Re: Portal Filtering- Changing filter with Radio Buttons?
              EP

                   Just my luck, I set this up using the last option.  I used a bunch of IF statements for my filters.  I have 2 sets of radio buttons.  Top set is to select the category, and the bottom set is to select a timeframe (current month, year to date, etc).  I created an IF statement for each possible combination and used a script trigger to refresh the portal.  What's so bad about option 3?

              • 4. Re: Portal Filtering- Changing filter with Radio Buttons?
                philmodjunk

                     It's one that can work great during developoment except for a rather annoying "flash" when the window is refreshed only to result in very long delays updating the window when you scale up to use it with real data over a network with lot's of records. If your client device is using FM GO, this can result in  extreme delays...

                     Since it's almost always possible to avoid using this script step, I do so to avoid any potential problems getting the window to update.

                • 5. Re: Portal Filtering- Changing filter with Radio Buttons?
                  EP

                       Thanks for the heads up. Is there any way to quickly search my fiel to see if refresh window [Flush Cached Join Results] appears in any other scripts?

                  I'm not sure how to set up my relationships.  I am using date functions to get certain periods of time.  I included a snapshot.  I have so many filters in this calc that I'm not even sure its possible to do this any other way.

                  • 6. Re: Portal Filtering- Changing filter with Radio Buttons?
                    philmodjunk
                         

                              Is there any way to quickly search...

                         If you have FileMaker Advanced, you can create a database design report and use your web browser to do a text search for that text to find every script step where it is used.

                         There are likely third party developer utilities that can also do this.

                         What is the relationship that you have defined linking your layout's table occurrence to the portal's table occurrence? What are the match fields used?

                         Can you copy the text from your filter expression to a clipboard and paste it? How does the filter expression differ on each tab?

                          

                    • 7. Re: Portal Filtering- Changing filter with Radio Buttons?
                      EP

                            

                      What is the relationship that you have defined linking your layout's table occurrence to the portal's table occurrence? What are the match fields used?

                           The portal is displaying on a dashboard, so I have a 1 field table (Dashboard::_fk linked to OfficePatients::_pkClientID) with a cartesian joint. I use this table for all Dashboards since I made it so records cannot be created in it.

                      Can you copy the text from your filter expression to a clipboard and paste it? How does the filter expression differ on each tab?

                                ///Referral Sorting
                                 
                                If ( OfficeCases::gReferrals = "Marketing" and OfficeCases::gReferrals2 = "Current Month" ;Date ( Month ( Get ( CurrentDate ) ) ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth and OfficeCases::CancelCase ≠ "Canceled" and OfficeCases::ReferralSource ≠  "Patient Referral" and OfficeCases::ReferralSource ≠  "Recalls"; "" ) or
                                 If ( OfficeCases::gReferrals = "Marketing" and OfficeCases::gReferrals2 = "Past Month" ; Date ( Month ( Get ( CurrentDate ) ) - 1 ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth and OfficeCases::CancelCase ≠ "Canceled"  and OfficeCases::ReferralSource ≠  "Patient Referral" and OfficeCases::ReferralSource ≠  "Recalls"; "" ) or
                                 If ( OfficeCases::gReferrals = "Marketing" and OfficeCases::gReferrals2= "Year to Date" ; Year (OfficeCases::DateReferred) = Year (Get (CurrentDate)) and OfficeCases::CancelCase ≠ "Canceled" and OfficeCases::ReferralSource ≠  "Patient Referral" and OfficeCases::ReferralSource ≠  "Recalls" ; "" ) or 
                                 
                                ////From Patients Sorting
                                If ( OfficeCases::gReferrals = "From Patients" and OfficeCases::gReferrals2 = "Current Month" ;Date ( Month ( Get ( CurrentDate ) ) ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth and OfficeCases::CancelCase ≠ "Canceled" and OfficeCases::ReferralSource  =   "Patient Referral"; "" ) or If ( OfficeCases::gReferrals = "From Patients" and OfficeCases::gReferrals2 = "Past Month" ; Date ( Month ( Get ( CurrentDate ) ) - 1 ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth and OfficeCases::CancelCase ≠ "Canceled"  and OfficeCases::ReferralSource  =   "Patient Referral"; "" ) or If ( OfficeCases::gReferrals = "From Patients" and OfficeCases::gReferrals2= "Year to Date" ; Year (OfficeCases::DateReferred) = Year (Get (CurrentDate)) and OfficeCases::CancelCase ≠ "Canceled" and OfficeCases::ReferralSource  =   "Patient Referral" ; "" ) or 
                                 
                                ////Recalls Sorting
                                If ( OfficeCases::gReferrals = "Recalls" and OfficeCases::gReferrals2 = "Current Month" ;Date ( Month ( Get ( CurrentDate ) ) ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth and OfficeCases::CancelCase ≠ "Canceled" and OfficeCases::ReferralSource  =   "Recalls"; "" ) or If ( OfficeCases::gReferrals = "Recalls" and OfficeCases::gReferrals2 = "Past Month" ; Date ( Month ( Get ( CurrentDate ) ) - 1 ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth and OfficeCases::CancelCase ≠ "Canceled"  and OfficeCases::ReferralSource  =   "Recalls"; "" ) or If ( OfficeCases::gReferrals = "recalls" and OfficeCases::gReferrals2= "Year to Date" ; Year (OfficeCases::DateReferred) = Year (Get (CurrentDate)) and OfficeCases::CancelCase ≠ "Canceled"  and OfficeCases::ReferralSource  =   "Recalls" ; "" ) or 
                                 
                                ////New Patients sorting
                                If ( OfficeCases::gReferrals = "New Patients" and OfficeCases::gReferrals2 = "Current Month" ;Date ( Month ( Get ( CurrentDate ) ) ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth  and OfficeCases::CancelCase ≠ "Canceled" and OfficeCases::NewPatient= "NEW" ; "" ) or 
                                If ( OfficeCases::gReferrals = "New Patients" and OfficeCases::gReferrals2 = "Past Month" ; Date ( Month ( Get ( CurrentDate ) ) - 1 ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth and OfficeCases::CancelCase ≠ "Canceled"   and OfficeCases::NewPatient= "NEW" ; "" ) or 
                                If ( OfficeCases::gReferrals = "New Patients" and OfficeCases::gReferrals2 = "Year to Date" ; Year (OfficeCases::DateReferred) = Year (Get (CurrentDate)) and OfficeCases::CancelCase ≠ "Canceled" and OfficeCases::NewPatient= "NEW" ; "" ) or 
                                 
                                ///Canceled Sort
                                If ( OfficeCases::gReferrals = "Canceled"  and OfficeCases::gReferrals2 = "Current Month"; Date ( Month ( Get ( CurrentDate ) ) ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth  and OfficeCases::CancelCase  =  "Canceled" ; "" ) or
                                If ( OfficeCases::gReferrals = "Canceled"  and OfficeCases::gReferrals2 = "Past Month"; Date ( Month ( Get ( CurrentDate ) ) - 1 ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth and OfficeCases::CancelCase  =  "Canceled" ; "" ) or 
                                If ( OfficeCases::gReferrals = "Canceled"  and OfficeCases::gReferrals2 = "Year to Date"; Year (OfficeCases::DateReferred) = Year (Get (CurrentDate)) and OfficeCases::CancelCase  =  "Canceled" ; "" )

                            

                      • 8. Re: Portal Filtering- Changing filter with Radio Buttons?
                        philmodjunk

                             So you have:

                             Dashboard X OfficePatients (The match fields don't have any effect on what records appear).

                             or is it:

                             Dashboard X OfficeCases

                             ???

                             Your filter expression refers to OfficeCases, but your post indicates that the relationship is to OfficePatients.

                             It appears that there are two global fields: gReferrals and gReferrals2 that control the results of the filter expression that you have posted. If you define these in the Dashboard table instead of in OfficeCases. WIthout modifying the filter expression, you could use this relationship:

                             Dashboard::gReferrals X OfficeCases::anyfield AND
                             Dashboard::gReferrals2 X OfficeCases::anyfield

                             and changes to either of these two fields should automatically update the filtered portal.

                             But I strongly recommend that you make every effort to simplify the filter expression. A pair of nested case functions could be used and a Let function can eliminate using the same calculation over and over again throughout the expression.

                             ///Referral Sorting
                             If ( OfficeCases::gReferrals = "Marketing" and OfficeCases::gReferrals2 = "Current Month" ;
                                  Date ( Month ( Get ( CurrentDate ) ) ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth and
                                  OfficeCases::CancelCase ≠ "Canceled" and
                                  OfficeCases::ReferralSource ≠  "Patient Referral" and
                                  OfficeCases::ReferralSource ≠  "Recalls"; ""
                                 ) or
                              
                              If ( OfficeCases::gReferrals = "Marketing" and OfficeCases::gReferrals2 = "Past Month" ;
                                   Date ( Month ( Get ( CurrentDate ) ) - 1 ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth and
                                   OfficeCases::CancelCase ≠ "Canceled"  and
                                   OfficeCases::ReferralSource ≠  "Patient Referral" and
                                   OfficeCases::ReferralSource ≠  "Recalls"; ""
                                  ) or
                              
                              If ( OfficeCases::gReferrals = "Marketing" and OfficeCases::gReferrals2= "Year to Date" ;
                                   Year (OfficeCases::DateReferred) = Year (Get (CurrentDate)) and
                                   OfficeCases::CancelCase ≠ "Canceled" and
                                   OfficeCases::ReferralSource ≠  "Patient Referral" and
                                   OfficeCases::ReferralSource ≠  "Recalls" ; ""
                                  ) or

                              

                        • 9. Re: Portal Filtering- Changing filter with Radio Buttons?
                          EP

                                

                          So you have:

                          Dashboard X OfficePatients (The match fields don't have any effect on what records appear).

                          or is it:

                          Dashboard X OfficeCases

                          ???

                                
                          Sorry, so many relationships I mistyped.  I have it as Dashboard X OfficeIntake (a table occurrence of OfficeCases).
                          I just made a new relationship:
                          Officecases::_fk X Dashboard2::_fk
                          Officecases::_Date X Dashboard2::_gReferrals
                          Officecases::_Date X Dashboard2::_gReferrals2
                                
                          Looks like I now have to change my filter expressions to match the global fields in the dashboard tabe (gReferrals 1 and gReferrals2).  Not too sure how to set up the Nested If statements using the Let function, so I may just set it up to see if it works first and then try the nested IFs.
                          Thanks
                          • 10. Re: Portal Filtering- Changing filter with Radio Buttons?
                            philmodjunk

                                 You also need to change OfficeCases to OfficeIntake. Though they have the same data source table, they are not interchangeable in a relationship.

                                 I recommend that you NOT use nested if funcitons here. Case will make life easier and you can use one Case function to test the value of gRefferrals and nest case functions inside for the three different possible values for gReferrals2.

                            • 11. Re: Portal Filtering- Changing filter with Radio Buttons?
                              EP

                                   Phil, got it working...mostly.

                                   Added a table occurrence and Cartesian joins from OfficeCases to DashboardPortals

                                    

                              Officecases::_fk X  DashboardPortals::_fk
                              Officecases::_Date X  DashboardPortals::_gReferrals
                              Officecases::_Date X  DashboardPortals::_gReferrals2

                                   DashboardPortals::gReferrals works as it should, However I can't get DashboardPortals::gReferrals2 to work properly.  It acts as if I didn't enter a result for my case statement and doesn't show "current month" in this example.

                                   Case ( DashboardPortals::gReferrals = "Marketing" ; OfficeCases::CancelCase ≠ "Canceled" and OfficeCases::ReferralSource ≠  "Patient Referral" and OfficeCases::ReferralSource ≠  "Recalls" ;DashboardPortals::gReferrals = "From Patients"; OfficeCases::CancelCase ≠ "Canceled" and OfficeCases::ReferralSource  =   "Patient Referral"; DashboardPortals::gReferrals = "Recalls" ; OfficeCases::CancelCase ≠ "Canceled" and OfficeCases::ReferralSource  =   "Recalls"; DashboardPortals::gReferrals = "New Patients" ; OfficeCases::CancelCase ≠ "Canceled" and OfficeCases::NewPatient= "NEW"; DashboardPortals::gReferrals = "Canceled" ; OfficeCases::CancelCase  =  "Canceled" ; DashboardPortals::gReferrals2 = "Current Month" ; Date ( Month ( Get ( CurrentDate ) ) ; 1 ; Year ( Get (CurrentDate ) ) ) = OfficeCases::cMonth )

                                    

                              EDIT: I had to add a new case statement for greferrals2.  Got it working. Thanks!

                              • 12. Re: Portal Filtering- Changing filter with Radio Buttons?
                                EP

                                     Phil, it is working perfectly.  Have 1 last thing to bother you about. 

                                      

                                     

                                Is there any way to quickly search...

                                If you have FileMaker Advanced, you can create a database design report and use your web browser to do a text search for that text to find every script step where it is used.

                                      

                                     Everytime I try to create this, I get errors that look like the following (see pic). I can create an XML, but it is difficult to locate where the scripts are being used.  I only found 2 instances of [Flush Cached results], however I can't easily locate where it is being used by looking in the XML, but the .html looks promising IF I can get it to work.  Any ideas?

                                • 13. Re: Portal Filtering- Changing filter with Radio Buttons?
                                  philmodjunk
                                  Officecases::_fk X  DashboardPortals::_fk
                                  Officecases::_Date X  DashboardPortals::_gReferrals
                                  Officecases::_Date X  DashboardPortals::_gReferrals2
                                        
                                  can be simplified to:
                                             
                                  Officecases::_Date X  DashboardPortals::_gReferrals
                                  Officecases::_Date X  DashboardPortals::_gReferrals2
                                             
                                            If I search my Known Bugs List Database for "SaxParseException", I find:

                                       For More Information see:     SAXParseException on exporting XML with XSLT specified if the field contains an invalid character.

                                       This is one of many acknowledged bugs that can be found in the Known Bug List thread here in the Report an Issue section of the forum.

                                       It can also be downloaded as a database file from:    https://www.dropbox.com/s/jt09b82i0xijbu3/FMP%20Bugs.zip

                                       Are you sure that you are specifying the HTML option when you generate this design report?

                                  • 14. Re: Portal Filtering- Changing filter with Radio Buttons?
                                    EP

                                         Yes. I have no problems generating the XML, Only HTML gives the error.  

                                    1 2 Previous Next