cancel
Showing results for 
Search instead for 
Did you mean: 

can any one tell me How to load data in matrix from user table

Former Member
0 Kudos

Hi,

we need to load data to matrix when page loads. After loading data we should add row to that matrix and update the values in database without effecting previous data. It should have functionality like UDO Default Form. Can any help me out in this issue.

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Souji,

try this,

SAPbouiCOM.Form oForm;

SAPbouiCOM.DataTable DBTable;

SAPbouiCOM.DBDataSource dbDatasource;

string strqry;

oForm = SBO_Application.Forms.Item("FormUID");

int i;

SAPbouiCOM.Item oitem;

oitem = oForm.Items.Item("ItemUID");

objMatrix = (SAPbouiCOM.Matrix)oitem.Specific;

objMatrix.AddRow(1, objMatrix.RowCount + 1);

dbDatasource = (SAPbouiCOM.DBDataSourceoForm.DataSources.DBDataSources.Item("TableName");

DBTable= oForm.DataSources.DataTables.Add("UniqueName");

strqry = "paste Query that you want to fetch";

DBTableActivity.ExecuteQuery(strqry);

for (i = 0; i <= DBTable.Rows.Count - 1; i++)

{

objMatrix.FlushToDataSource();

dbDatasource.SetValue("column1(name)", i, System.Convert.ToString(DBTable.GetValue(0, i)));

dbDatasource.SetValue("column2(name)", i, System.Convert.ToString(DBTable.GetValue(1, i)));

dbDatasource.SetValue("column3(name)", i, System.Convert.ToString(DBTable.GetValue(2, i)));

dbDatasource.InsertRecord(i + 1);

objMatrix.LoadFromDataSource();

}

If it helps you, give me the reward points.

Thanks

Sravan Kumar Pothu

Answers (1)

Answers (1)

Former Member
0 Kudos

hi souji,

from the above reply you can only fill the data from the database to the matrix.

After you fill the matrix,

you have to set the form mode to update mode.

then the form comes to update mode, so u can update the existing records and also add the newly added rows to the database.

Regards,

jagadeesh.v