How to manage Row Index in GridGroupingControl?
GridGroupingControl control is not row index based grid. The ideal way to tackle this is to rely on the displayed elements.
This sample script replaces the GreatGrandChildName26 to MyName, refer to the screen shot of the replay below with explanation of each element till the modified record.
VB
SwfWindow("GridGroupingControl").Move 347,344
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 5,"parentID"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").ExpandRecord 5
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 10,"childID"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").ExpandRecord 10
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 15,"grandChildID"
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").ExpandRecord 15
tablename = SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").GetTableNameByLevel(3)
colIndex = 2
colname = SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").GetColumnName(tablename, colIndex)
SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCellData 19, colname, "MyName"
Screenshot of the replayed sample with notes of each element. This sample can be referred in Essential TestStudio\Examples\Samples\bin\2.0\Grid\GGC_Hierarchical.exe
The helper function GetRowElement can also be used to know the kind of the element behind the row.
VB
For row = 1 To SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").GetRowCount() -1 Step 1
MsgBox SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").GetRowElement(row)
Next