5 Replies Latest reply on Feb 29, 2016 12:38 AM by twelvetens

    Filtered Portal hangs on Boolean Logic

    twelvetens

      I've got a filtered portal on a layout.

       

      The table at the "other end" of the portal has a calc field in to derive a boolean outcome to determine whether or not the entry should show up in the portal:

       

      Let (

      [

      fsd = DailyComparisons::zg_ComparisonStartDate ;

      fed = DailyComparisons::zg_ComparisonEndDate ;

      fsku = Globals_Filter::zg_StockSKUFilter ;

      fbec = Globals_Filter::zg_OnlyShowChangedBreakevenItems ;

       

      sku = DailyComparisons::M2YSKU;

      cd = DailyComparisons::Date_Comparison ;

      bec = DailyComparisons::zc_BreakevenChange ;

       

      dates =

        (IsEmpty ( fsd ) and IsEmpty ( fed ) )

        or

        (cd ≥ fsd and cd ≤ fed ) ;

       

      breaks =

        IsEmpty ( fbec )

        or

        bec = 1 ;

       

      skus =

        IsEmpty ( fsku )

        or

        PatternCount ( sku ; fsku )

       

       

      ]

       

      ;

      dates and breaks and skus

      //Close Let

      )

       

       

      When I configure the portal to be Unfiltered, yet show the above field in each row, as I modify the global fields that drive the above calc, the calculations in each row show up exactly as I want them to, e.g showing a 1 for rows to display, and a 0 for rows I wish to hide.

       

      However, when I then configure the portal to filter, based upon the value in the above calc, I just get a spinning beach ball. It doesn't appear to ever actually crash, it just seems to hang forever.

       

      I've patched up to 14.0.5 as I know that patch seems to fix the v14.0.x crashing on sorted portals issue, but still no joy.

      File is hosted on Windows Server, I'm running on OSX 10.11.2

       

      Is there any reason why the logic that drives the calc I've done should be unsuitable for the portal filtering criteria?

        • 1. Re: Filtered Portal hangs on Boolean Logic
          Mike_Mitchell

          James Glendinning wrote:

           

          Is there any reason why the logic that drives the calc I've done should be unsuitable for the portal filtering criteria?

           

          Yes. It's a complex unstored calculation that has to be evaluated for every related record. I suggest you change it to an auto-enter calculation, which can be indexed, and see what that does for you.

          • 2. Re: Filtered Portal hangs on Boolean Logic
            twelvetens

            I hear you Mike, but how come when I'm changing the global fields with the unfiltered portal showing, the unstored calcs all refresh instantly, with no lag at all? Doesn't that imply that the dependancies are sufficiently simple to allow the portal-filtering to work ok too?

            • 3. Re: Filtered Portal hangs on Boolean Logic
              twelvetens

              As an update on this, I seem to have resolved the issue, but I don't understand why:

               

              I've now changed the formula driving the filtered portal to a non-let structured syntax:

               

              (IsEmpty ( DailyComparisons::zg_ComparisonStartDate ) and IsEmpty ( DailyComparisons::zg_ComparisonEndDate ) )
              or
              (DailyComparisons::Date_Comparison ≥ DailyComparisons::zg_ComparisonStartDate and DailyComparisons::Date_Comparison ≤ DailyComparisons::zg_ComparisonEndDate )

               

               

              and

               

               

              (
              IsEmpty ( m2y groupon_Filter::zg_StockSKUFilter )
              or
              PatternCount ( DailyComparisons::M2YSKU ; m2y groupon_Filter::zg_StockSKUFilter )
              )

               

               

              and

               

               

              (
              IsEmpty ( m2y groupon_Filter::zg_OnlyShowChangedBreakevenItems )
              or
              DailyComparisons::zc_BreakevenChange = 1
              )

               

              And now it all seems to work perfectly?!

               

              So I'm still interested in what the difference is between the two approaches. Any ideas?

              • 4. Re: Filtered Portal hangs on Boolean Logic
                Mike_Mitchell

                Here's one:

                 

                In your original calculation, OnlyShowChangedBreakevenitems comes from the Globals_Filter table.

                 

                In the new one, it comes from m2y groupon_Filter.

                 

                Similarly, in the first calc you have Globals_Filter::zg_StockSKUFilter. In the second, you have m2y groupon_Filter::zg_StockSKUFilter.

                 

                Those are differences. Whether they matter or not, I don't know.

                • 5. Re: Filtered Portal hangs on Boolean Logic
                  twelvetens

                  Hi Mike, well spotted, in actual fact, those TO names shouldn't make a difference, and I've found that I think the main performance crisis is down to the zc_BreakevenChange calculation, so I'm trying to make that a stored calc now. Thanks for all your help...