Perspective Table Subview Script Control

Is there a way to control a perspective table’s subview through scripts? Toggle Expand and Collapse? I already scripted a ‘select the expanded row’ but that is only half the problem.

If I expand a subview, passing that rows parameters, then change the selected row the parameters update but the subview doesn’t change to the new selected record. Can one collapse the previous subview and expand the selected row’s subview?

It makes no sense to have this feature drilling into a rows data if the subview doesn’t match the selected record.

In 8.1.17 (see release notes):

The Table component now has two scripting functions: expandSubviews and collapseSubviews. ExpandSubviews takes in an array of indices of rows to expand (will only expand rows that are currently visibly displayed on the table) and collapseSubviews takes in either an array of indices of rows to collapse (will only collapse rows that are currently visibly displayed) OR no parameter at all to collapse all currently expanded subviews that are part of the current visible data