AnsweredAssumed Answered

Conditional Formatting of a Portal Row Based on Previous Row

Question asked by Reid Larson on Aug 27, 2014
Latest reply on Jun 16, 2017 by DavidRoy_1


Conditional Formatting of a Portal Row Based on Previous Row


     I have a table we'll call Table. On the layout for Table, there's a portal for the table Item. They're related by the primary key and foreign key of Table.

     Item has several fields in it. Relevant ones are __kp_Item, an auto-enter serial; Balance_Beginning; and Balance_Ending.

     I want to use conditional formatting on Balance_Beginning when it doesn't equal the previous row's Balance_Ending. I don't think the rows will ever have to be sorted in a different order, but I'd like to account for that if possible. I've searched around a bit and found this post on another forum that seems to do what I want to do. This situation was a bit different because it was about comparing when one date is before another in the previous row. I'll past the relevant code here.

     Conditional formatting on the serial number for the item:

          Let( [
          $n = $n+1
          ; 0
               Let( [ 
               $thisDate[$n] = GetAsNumber( item::expires ); 
               $flag = Case($thisDate[$n] < $lastDate; 1; 0) ;
          This doesn't actually format anything. I believe it's there just to set the variables.
          Conditional formatting on the field to actually change:
               Case( item::id; $flag)
          I'm having trouble dissecting all this code and adapting it to my scenario. I get that $n = $n+1 is a counter of sorts, but I'm not sure how it works when in the repetition brackets of the later variables.

     I understand that $flag is a case designed to return either 1 for true or 0 for false, in order to set the actual formatting

     I definitely don't understand why $lastdate is set to $thisdate[$n]'s value, nor why item::id is used in the case for the field being formatted.


     I hope someone can walk me through this, because it seems like a useful formula to know.