Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Slow performance of reading row by row in Grid

Hi,

I am appreciate if anyone can assist on the following issue that i encountered.

I have the following details:

Form1 + Matrix + 1 Command Button

Form2 + Grid (with datatable)

Assuming Grid data in Form2 contained 500 records, and matrix in Form1 is empty. After i selected two records from Grid in Form2, these two records will be copied to grid in Form1.

After copied, this meant that Form1 's matrix contained of 2 records, and Form2 's grid contained of 498 records. When i triggered the command button in Form1, i will need to remove the 2 records that previously added from datatable in Form2 's grid.

But this will cause the system performs very slow, please refer to below for the sample code.

For iRow = oMatrix.RowCount - 1 To 1 Step -1

oEditTxt1 = oMatrix.Columns.Item("1").Cells.Item(iRow).Specific

If Trim(oEditTxt1.Value) <> "" Then

For jRow = oGrid.Rows.Count - 1 To 0 Step -1

If oGrid.DataTable.Columns.Item(4).Cells.Item(jRow).Value = oEditTxt1.Value Then

oGrid.DataTable.Rows.Remove(jRow)

Exit For

End If

Next jRow

End If

Next iRow

Kindly advise is there any solution or alternative ways i can do to improve the speed?

Thanks in advance.

Regards,

cks

replied

Hello Roland,

You really know SQL and SDK well (--For Browse). : )

I will suggest that DON'T use this. The query in DI is designed for Data manipulation only, not for Data Definition. Just to protect the data and avoiding accidence.

The solution in this case is also working with xml.

oDataTable.GetAsXml()

'Manipulate with xml

oDataTable.LoadFromXml()...

The bottle neck for the performance problem here is

Too many RPC (Remote Process Call) calls in the big loop. UI is an inter-process COM server. Every UI function call is a RPC, consuming more 3~10 times' time than in process function call (xml function call).

So the solution:

1.Working with xml: Use in-process xml funciton call intead of UI call (RPC)

2.Cache: Cahced some UI object, etc collections. instead retrieve again over again

Kind Regards

-Yatsea

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question