7 Replies Latest reply on May 13, 2016 2:08 PM by erolst

    display rules on a portal

    flyzone

      Hi all,

      I'm selecting a list of items from a portal and the conditions is that the items needs to be current so the "Active" items are generated by this condition:

       

      If ( ( Year_Num & Month_Num ) ≥ ( Year ( Get ( CurrentDate ) ) & Right ( 0 & Month ( Get ( CurrentDate ) ); 2 ) ) ; "Active" ; "" )

      & ¶ &

      "All"

       

      Now I also want to include on the condition that if the item is sold out it shouldn't display.

      Meaning if "Remaining Items" are = 0 don't show them in Active.

       

      How can you modify the rule? I've tried multiple things but the results are less than stellar

       

      Thanks

        • 1. Re: display rules on a portal
          erolst

          flyzone wrote:

          Now I also want to include on the condition that if the item is sold out it shouldn't display.

          Meaning if "Remaining Items" are = 0 don't show them in Active.

           

          How can you modify the rule? I've tried multiple things but the results are less than stellar

          Try

           

          Let ( [

            cd = Get (CurrentDate ) ;

            itemIsCurrent = Year_Num & Month_Num ≥ Year ( cd ) & SerialIncrement ( "00" ; Month ( cd ) ) ;

            notSoldOut = Remaining Items > 0

            ] ;

            If ( itemIsCurrent and notSoldOut ; "Active" )

          )

           

          though I'm not exactly sure how you are using this …

          • 2. Re: display rules on a portal
            flyzone

            What's "yd" stands for?

             

            The reason behind the Active and All is because I have a switch (radio button) when I can select Active to see only the current items or All where I can select from the entire list of items even past one.

            • 3. Re: display rules on a portal
              erolst

              flyzone wrote:

              What's "yd" stands for?

               

              An artefact from an incomplete editing; see corrected version.

              • 4. Re: display rules on a portal
                flyzone

                Thank you, I can see the full script.

                It seems clear but it's still not working for me. I don't know if the issues are somewhere else because every time I chance the formula then even if I copy and paste back the original the portal doesn't work anymore.

                The field appear empty.

                • 5. Re: display rules on a portal
                  erolst

                  So, this is a portal filter?

                   

                  I was asking before because you cannot store that calculation, or Get(CurrentDate) won't update – but you cannot use an unstored calculation as match field on the data side of a relationship.

                   

                  So it must be a portal filter calc, but then you're not calculating a Boolean result, which is what a portal filter calculation wants to see …

                   

                  So for me this works (note the modified date comparison):

                   

                  Screen Shot 2016-05-13 at 21.01.14.png

                   

                  Note that you don't even need to create a calc field – you could put the entire calculation into the portal filter, where you say:

                   

                  Let ( [

                  … // as above

                  // result is now Boolean:

                  If ( itemIsCurrent and notSoldOut ; "Active" )

                  or

                  filterField = "Active"

                  )

                  • 6. Re: display rules on a portal
                    flyzone

                    yes it is a portal filter. When you click add new record you get presented with the option on the portal. See attachment.

                     

                    so this is what your suggesting?

                    Let( [ cd = Get ( CurrentDate ); ItemIsCurrent = theDate - Day ( theDate ) + 1  ≥ Date (Month (cd);1; Year ( cd )); notSoldOut = Impressions_Remaining  > 0 ]; ItemIsCurrent and notSoldOut; or filterField = "Active" )

                     

                    Screen Shot 2016-05-13 at 3.31.46 PM.png

                    • 7. Re: display rules on a portal
                      erolst

                      flyzone wrote:

                      so this is what your suggesting?

                      Let ( …  )

                      Yes, that works for me - and maybe apply some (any) kind of formatting …?!