PeopleCode to get a Sibling RowSet

For some reason this just took me far too long to figure out. Must be getting old. Writing down for reference.

Let's say you have a page with a Record structure like this:

   Sibling 1
   Sibling 2

And you want some code/event on Sibling 1 to change the data in Sibling 2.

The somewhat unusual scenario I had is that Sibling 2 is a kind of audit record for Sibling 1, so that every time data changed on Sibling 1 a new row was inserted into Sibling 2 with Oprid and DateTime etc.

Normally you could just have Sibling 2 as a child of Sibling 1 (and technically it is) but in my scenario Sibling 1 was already at Level 3. The data  was to be displayed. I had no room to move.

Place the following in something like SIBLING_1.Field1.SaveEdit()

Local Rowset &rsSIBLING_2 = GetRowset().ParentRow.GetRowset(Scroll.SIBLING_2);

You'll now have the sibling Record as a RowSet.

.ParentRow is the property of the RowSet you are looking for.