cancel
Showing results for 
Search instead for 
Did you mean: 

How do you read data from collapsed rows in a matrix

Former Member
0 Kudos

I need to read the data of a "Withholding tax report" to print a document. There only 4 visible rows all the other rows are collapsed; but my add-on needs the hidden rows, and don't want to depend on wether the user has pressed the expand button or not.

Accepted Solutions (1)

Accepted Solutions (1)

FOA
Advisor
Advisor
0 Kudos

Hello Jurgen,

What about accessing that form (Withholding tax report) get the matrix object and then with property "RowCount" you can get the number of lines of the report even when they are hidden. After that you can iterate through all of them.

If you want to get the number of lines that are displayed in the GUI(with out taking into consideration the hidden ones) you can use property "VisualRowCount".

Hope this helps,

Felipe Ortega

Former Member
0 Kudos

This I tried (of course) but sap cannot handle a rowcount index larger than the visualrowcont.

Example

This code works fine:

string tmp;

SAPbouiCOM.Item oItem = oForm.Items.Item("some_grid");

SAPbouiCOM.Cells oAmountCells = ((SAPbouiCOM.Columns)((SAPbouiCOM.Matrix)oItem.Specific).Columns).Item("5").Cells; //5th column

iRows = ((SAPbouiCOM.Matrix)oItem.Specific).VisualRowCount;

for (int i=1; i<=iRows; i++)

{

tmp = ((SAPbouiCOM.EditText)oAmountCells.Item(i).Specific).String;

}

But if you change

iRows = ((SAPbouiCOM.Matrix)Item.Specific).VisualRowCount;

into

iRows = ((SAPbouiCOM.Matrix)Item.Specific).RowCount;

the code will crash if you reach an index larger then the VisualRowCount.

Moreover you will never see a value in "tmp" of a row that isn't displayed.

FOA
Advisor
Advisor
0 Kudos

I see...

Then why dont you expand all the cells by pressing the expand button by code, obtain the data you need, and reset how the form was by pressing the collapse button.

Former Member
0 Kudos

I finnaly wrote a query to retrieve the relevant data from the database. Expanding and collapsing everything on the screen also crossed my mind; but I find this a solution I definitly want to avoid.

Answers (0)