5 Replies Latest reply on Feb 27, 2012 6:50 AM by GianandreaGattinoni

    Portal Filtering



      Portal Filtering


      FM 11.03, Windows 7

      I have a self join table (TABLE_1 and table_2)

      In a layout that displays TABLE_1, I have a portal for TABLE_2

      I want to filter the records in the portal based on field ACTIVE (possible values 0/1)

      Moreover I want to activate or deactivate dynamically the filter. To do that I define a global variable FILTER  with possible values 0=deactivate the filter, 1= activate the filter

      So I defined the formula to filter the portal:

      if(TABLE_2::FILTER ; TABLE_2::ACTIVE ; 1)

      if FILTER equal 0 displays all records (result 1), if FILTER equal 1display depends on the value of field ACTIVE.

      The problem is that the records are not filtered correctly neither updated changing the value of FILTER.

      So I thought to change the method.

      I defined a calculation variable FILTER_2 with the same formula: if(TABLE_2::FILTER ; TABLE_2::ACTIVE ; 1) and I base the portal filter only on this variable (possible values 0/1

      Same problem with different results. Displaying in the portal the value of FILTER_2 you sees that all values are correct

      I tested the same with two different related tables and the results did not change

      I’m doing something wrong?


        • 1. Re: Portal Filtering

          Your original filter expression should work, but there's a window refresh issue. Return to your original expression and run this script after changing the value of Filter:

          Refresh Window [Flush cached join results]

          If that updates the portal filter and you see the expected change in the records shown, then your filter expression is correct.

          Refresh Window [ Flush cached join results ] is a step best avoided, however. It can result in signficant delays while waiting for the window to update. Modify your portal relationship to include the global Filter field using the cartesian join operator:

          Table 1::Filter X Table 2::anyfield

          If you already have other fields in your relationship that match with other operators than X, keep them and just add the above pair of fields to it:

          Table 1::Field = Table 2::Field AND
          Table 1::Filter X Table 2::anyfield

          • 2. Re: Portal Filtering


            For the filter field in the layout I defined a trigger OnObjectExit that runs a script with: Refresh Window [Flush cached join results] and it works.

            That strange is that if you change the value one record of the field Table_1::Active, with the filter applied, FM update the portal on the fly. So it seems that FM is able to update the cahe if it has not a calculation or a formula in the filter definition.



            • 3. Re: Portal Filtering

              I have tried also the other method but it does not work. I always see all records.


              • 4. Re: Portal Filtering

                Changes to values in the filter will update without problem. Changes to the value of Table_1::Filter require the refresh [Flush...] step or a relationship with the X operator before you see the update.

                What is the relationship that you have defined for your portal? (Need to know the exact fields and operators).

                And exactly what filter expression?

                I'm looking for a reason why it did not update for you.

                • 5. Re: Portal Filtering

                  Sorry, It works (my stupid mistake)

                  Many thanks