Skip to Content
0
Former Member
May 18, 2010 at 03:39 PM

Fill a matrix usign recordset

167 Views

Hi, i'm trying to fill a matrix with this, becouse i don't know how to do it using Datasources, this Table Have information from 2 diferents tables.

void loadMatrix (APbouiCOM.Matrix objMatrix, string fInicial, string fFinal) {

int i = 0;

SAPbobsCOM.SBObob objSBo = (SAPbobsCOM.SBObob)objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge);

string sql,fechainicial,fechafinal;

DateTime FInicial, FFinal;

FInicial = Convert.ToDateTime(fInicial);

FFinal = Convert.ToDateTime(fFinal);

fechainicial = FInicial.Day.ToString() + "/" + FInicial.Month.ToString() + "/" + FInicial.Year.ToString() + " 00:00:00.000";

fechafinal = FFinal.Day.ToString() + "/" + FFinal.Month.ToString() + "/" + FFinal.Year.ToString() + " 00:00:00.000";

try

{

rPedido = (SAPbobsCOM.Recordset)objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

sql = "SELECT ORDR.DocNum, ORDR.TaxDate, RDR1.LineNum, RDR1.ItemCode, RDR1.Dscription, RDR1.Quantity, RDR1.U_Plazo_Entrega, RDR1.U_Descripcion, RDR1.U_Fecha_Entrega FROM ORDR INNER JOIN RDR1 ON ORDR.DocEntry = RDR1.DocEntry WHERE ORDR.TaxDate >='" + fechainicial + "' AND ORDR.TaxDate <='" + fechafinal + "'";

rPedido.DoQuery(sql);

if (rPedido.RecordCount == 0)

{

objAplicacion.MessageBox("ERROR", 1, "dadad", "dasdadasd", "asdadsad");

}

else

{

objAplicacion.MessageBox("FINE : " + rPedido.RecordCount.ToString(), 1, "dadad", "dasdadasd", "asdadsad");

for (i = 0; i < rPedido.RecordCount; i++)

{

rPedido.MoveFirst();

//I was trying this way

// objMatrix.Columns.Item("c_cod_ped").Cells.Item(i).Specific -> i'm using c# and the Specific doesnt have Value

// objMatrix.Columns.Item(""c_cod_ped).Cells.Item(i).Specific.Value -> this way it's how a lot of people do it, but they do it in Visual Basic.

}

catch (Exception er) {

throw er;

}

}

i'm to new in SBO, the other metod that the people uses is with DataSources but I'm lost usign it...

Thanks.