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) ;$lastdate=$thisdate[$n]];$flag)
Case( item::id; $flag)
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.