Skip to Content
Former Member
Jun 08, 2010 at 11:16 AM

Matix with query


Hi experts,

I want to fill my matrix with the result of my query. Here is my code, I do not know where the error but I get the following message: Collection - Out of boundaries.

If (pVal.ItemUID = "RechNav") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then

Dim f As SAPbouiCOM.Form

f = SBO_Application.Forms.Item("Liste_escale")

Dim oMatrix As SAPbouiCOM.Matrix = f.Items.Item("3").Specific

Dim req As SAPbobsCOM.Recordset

req = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

req.DoQuery("SELECT U_CdNav, U_NLloyd, U_NDclrNav, U_PavDN, U_Cng, U_AgCng, U_Arm, U_AgSh, U_DatArE, U_DateDep, U_TpOcPos, U_TImpt, U_TEmb FROM [@DESC] WHERE U_CdNav='" & TxtCodN.Value & "'")

Dim i As Integer = 0


With f.DataSources.DBDataSources.Item("DESC")

While (req.EoF = False)

oMatrix.SetValue("V_0", i, req.Fileds.Item("U_CdNav").Value.ToString)

oMatrix.SetValue("V_13", i, req.Fileds.Item("U_NLloyd").Value.ToString)

oMatrix.SetValue("V_12", i, req.Fileds.Item("U_NDclrNav").Value.ToString)

oMatrix.SetValue("V_11", i, req.Fileds.Item("U_PavDN").Value.ToString)

oMatrix.SetValue("V_10", i, req.Fileds.Item("U_Cng").Value.ToString)

oMatrix.SetValue("V_9", i, req.Fileds.Item("U_AgCng").Value.ToString)

oMatrix.SetValue("V_8", i, req.Fileds.Item("U_Arm").Value.ToString)

oMatrix.SetValue("V_7", i, req.Fileds.Item("U_AgSh").Value.ToString)

oMatrix.SetValue("V_6", i, req.Fileds.Item("U_DatArE").Value.ToString)

oMatrix.SetValue("V_5", i, req.Fileds.Item("U_DateDep").Value.ToString)

oMatrix.SetValue("V_4", i, req.Fileds.Item("U_TpOcPos").Value.ToString)

oMatrix.SetValue("V_3", i, req.Fileds.Item("U_TImpt").Value.ToString)

oMatrix.SetValue("V_2", i, req.Fileds.Item("U_TEmb").Value.ToString)


i = i + 1


End While

End With


End If

Edited by: Olivier KPOLO on Jun 8, 2010 1:16 PM

Edited by: Olivier KPOLO on Jun 8, 2010 1:23 PM

Edited by: Olivier KPOLO on Jun 8, 2010 1:24 PM

Edited by: Olivier KPOLO on Jun 8, 2010 1:27 PM