Hide a Row in a Grid or Scroll Area Using PeopleCode

Your rating: None Average: 4.3 (9 votes)

The picture below shows a gird with 2 rows, one of Address Type "Home" and the other with Address Type "Mailing". I would like to hide rows on the grid that have anything other than Address Type "Home":

Grid before peoplecode hide

Now what I would like to accomplish is this:

Grid after row hide peoplecode

And now the code on how to go about doing this:

Local Rowset &Level1;

&Level1 = GetLevel0()(1).GetRowset(Scroll.PERSON_ADDRESS);
For &i = 1 To &Level1.ActiveRowCount
If &AddrType <> "HOME" Then
&Level1(&i).Visible = False;

Visible Property Description

If this property is True, the row is visible if displayed on the current page. This property can be set False to hide the row.

When Visible is set to False to hide a row, the row moves to the end of the rowset. This means that the row number of the row being hidden, and any subsequent rows, changes as a result of hiding a row. If the row is later made visible again, it is not moved back to its original position, but remains at the end of the rowset. It is just moved to the start of all the other hidden rows.

For example, if there are 4 rows in a rowset and row 2 is hidden (that is, Visible = False), that row now becomes row 4. In order to make that row visible again, row 4 must be set to Visible = True. Alternatively, you can use a row object reference: this remains valid even though the row number of the row may have been changed.

You cannot hide rows in the current context of the executing program. This means Visible cannot hide the row containing the executing program, or in a child rowset and be executed against its parent rowset. Place your PeopleCode in a parent rowset and execute it against a child rowset.

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!