cancel
Showing results for 
Search instead for 
Did you mean: 

Data Bind to Matrix

Former Member
0 Kudos

Hi All,

Am trying to bind more data to matrix, its getting late and required more time.

Like

if there is 1000 records to bind, i will take 5 minutes time.

My code as bellow.

  If rsGetSalGenDetailswoCategory.RecordCount > 0 Then

  oMatrix.Columns.Item("V_3").Cells.Item(oMatrix.RowCount).Specific.Value = rsGetSalGenDetailswoCategory.Fields.Item("U_CrGlCode").Value

                                    oMatrix.Columns.Item("V_2").Cells.Item(oMatrix.RowCount).Specific.Value = rsGetSalGenDetailswoCategory.Fields.Item("U_CrGlName").Value

                                                                 oMatrix.Columns.Item("V_0").Cells.Item(oMatrix.RowCount).Specific.Value = rsGetSalGenDetailswoCategory.Fields.Item("AB").Value

End If

Please help if any faster solution.

Accepted Solutions (1)

Accepted Solutions (1)

pedro_magueija
Active Contributor
0 Kudos

Hi Nandappa,

It's not recommended to fill up the matrix using the UI API.( oMatrix.Columns.Item("V_2").Cells.Item(oMatrix.RowCount).Specific.Value = rsGetSalGenDetailswoCategory.Fields.Item("U_CrGlName").Value)

You should use the datasource that is bound to the matrix. If you are using a DBDataSource or DataTable use the GetValue and SetValue methods to populate the columns.


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn
Follow @pedromagueija on Twitter

Former Member
0 Kudos

HI Pedro Magueija,

I tried this

oform.DataSources.DataTables.Add("X")

oform.DataSources.DataTables.Item("X").Clear()

Dim sSQL As String = "SELECT ItemCode,ItemName FROM oitm"

oform.DataSources.DataTables.Item("X").ExecuteQuery(sSQL)

oMatrix = oform.Items.Item("mtx_0").Specific

oMatrix.Columns.Item("col_2").DataBind.Bind("X", "ItemCode")

oMatrix.Columns.Item("col_3").DataBind.Bind("X", "ItemName")

oMatrix.LoadFromDataSource()

But here what is 'X'.

In my code am getting data with my sql query,

Could you please send the sample code.

pedro_magueija
Active Contributor
0 Kudos

Hi Nandappa,

If you are loading from an SQL query, and using an UDO, then it is far easier to use a Grid instead.

For a grid it would be:


DataTable dt = form.DataSources.DataTables.Add("DataTableId");

dt.ExecuteQuery(myQuery);

oGrid.DataTable = dt;

For a matrix:


Form form = b1.Application.Forms.Add(DateTime.Now.Ticks.ToString(), BoFormTypes.ft_Fixed);

var matrix = (Matrix)form.Items.Add("temp", BoFormItemTypes.it_MATRIX).Specific;

DataTable dt = form.DataSources.DataTables.Add("temp");

form.Visible = true;

string sql = @"SELECT CardCode, CardName FROM OCRD";

dt.ExecuteQuery(sql);

matrix.Columns.Add("#", BoFormItemTypes.it_EDIT);

matrix.Columns.Add("cardCode", BoFormItemTypes.it_EDIT);

matrix.Columns.Add("cardName", BoFormItemTypes.it_EDIT);

matrix.Columns.Item("cardCode").DataBind.Bind("temp", "CardCode");

matrix.Columns.Item("cardName").DataBind.Bind("temp", "CardName");

matrix.LoadFromDataSource();


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn
Follow @pedromagueija on Twitter

Answers (0)