cancel
Showing results for 
Search instead for 
Did you mean: 

How to load matrix from UDT faster

kinyanjuikamau
Explorer
0 Kudos

Hello folks,

I have an addon I am making using a user defined form, b1f and a user defined table that is of no object.

I do a loop through the query results like this:

for (int i = 0; i < oRecordSet.RecordCount; i++)
{
oForm.Freeze(true);
Matrix0.AddRow(1, i + 1);
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_0").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("U_SubFileNo").Value.ToString();
((SAPbouiCOM.ComboBox)Matrix0.Columns.Item("Col_1").Cells.Item(i + 1).Specific).Select(oRecordSet.Fields.Item("U_DCC_CNTS").Value.ToString(), SAPbouiCOM.BoSearchKey.psk_ByValue);
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_2").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("NumAtCard").Value.ToString();
((SAPbouiCOM.ComboBox)Matrix0.Columns.Item("Col_3").Cells.Item(i + 1).Specific).Select(oRecordSet.Fields.Item("U_ServiceMode").Value.ToString(), SAPbouiCOM.BoSearchKey.psk_ByValue);
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_4").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("Quantity").Value.ToString();
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_5").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("U_Received").Value.ToString();
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_6").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("Packages").Value.ToString();
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_7").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("CardCode").Value.ToString();
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_8").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("CardName").Value.ToString();
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_20").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("U_CustN").Value.ToString();
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_9").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("U_Consignee").Value.ToString();

string amount = oRecordSet.Fields.Item("Amount").Value.ToString();
string amt = amount.Replace(',', '.');
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_10").Cells.Item(i + 1).Specific).Value = amt;
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_21").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("DocCur").Value.ToString();
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_11").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("Phone1").Value.ToString();
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_12").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("DocNum").Value.ToString();
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_18").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("U_SalesOrderNo").Value.ToString();
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_19").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("U_InvoiceNo").Value.ToString();
((SAPbouiCOM.ComboBox)Matrix0.Columns.Item("Col_13").Cells.Item(i + 1).Specific).Select(oRecordSet.Fields.Item("U_Location").Value.ToString(), SAPbouiCOM.BoSearchKey.psk_ByValue);
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_15").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("U_RcvdBy").Value.ToString();
((SAPbouiCOM.EditText)Matrix0.Columns.Item("Col_16").Cells.Item(i + 1).Specific).Value = oRecordSet.Fields.Item("U_Status").Value.ToString();
((SAPbouiCOM.ComboBox)Matrix0.Columns.Item("Col_17").Cells.Item(i + 1).Specific).Select(oRecordSet.Fields.Item("U_RecOff").Value.ToString(), SAPbouiCOM.BoSearchKey.psk_ByValue);
oRecordSet.MoveNext();
oForm.Freeze(false);
}

The problem is that this method is too slow. 30 seconds for just 100 records to load.

I have bound each column of the matrix to the respective @FMS2 fields.

How do I load this faster?

Regards,

kinyanjuikamau
Explorer
0 Kudos

I solved this using datatables then load from datasource.

Accepted Solutions (0)

Answers (0)