cancel
Showing results for 
Search instead for 
Did you mean: 

Ui oMatrix collaps

Former Member
0 Kudos

Hi all,

sorry for this question. but I do not understand clearly, when do I use Grid and when matrix.

the Matrix do not have a collapse function as I see.

Are there any rules on best practice?

Again sorry for this question but I just starting with UI's and I have not found so much on this.

Regards

Oliver

Accepted Solutions (1)

Accepted Solutions (1)

former_member183373
Active Participant
0 Kudos

Hi Oliver,

You usually use matrix object when you are going to display a specific table. You add all the columns you wanna display to the matrix and set its properties. However if you are going to display the result of a query that may have different number of columns  using grid  would be the most efficient.

Assume that you prepared  a form that will show the result of a search operation filtered by the user. You can use grid object. and set the properties of your grid in the code according to your query result. But If you are going to display a specific table you can just use matrix object and bound it to your datasource.

Regards,

Atilla

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Atila,

ok. As it looks like.. the grid is at any time bond to a data table and there ist no option to add a column i guess.

but the grid has the option to group and collapse... that the matrix won't have?

f.ex. I Do have an UDO Document, I would like to show these in a Matrix. one of the Columns is user data ... with a checkbox. that what I'm looking for is a grouping like the grid... so that the user catch the data obviously ....

there 20 Documents (UDO) to work on. and there are 1 to 10 lines  for each document... but not each line have to work on directly... so the user could work on 2 of 10 lines and set the process on this lines. and the last lines maybe later...

in the second process the 2 finished lines won't be displayed...

on visibility, a grouping is not bad...

I tried both... and I suggest using the Matrix, but it would be much more efficient if there was an option to collapse... these lines...

OK, but I think if I'm right on my suggestion... that I understand what you mentioned.

Thankx

and regards

Oliver

former_member183373
Active Participant
0 Kudos

Hi Oliver,

You can add column to both Grid and Matrix. Also they both have collapse event but I didn't understand what do you mean by grouping.

As I understand you want to show specific data to the user. You can use grid object to display any type of data you want. You can merge the result of your queries. You can set the number of rows and columns which are going to displayed.

Here is a sample of how you create a DataTable and set it to your grid. I hope it helps.

// Create Your SAPbouiCOM DataTable

SAPbouiCOM.DataTable oDataTable = null;

if (oForm.DataSources.DataTables.Count.Equals(0))

{

                oForm.DataSources.DataTables.Add("dtData");

}

else

{

                oForm.DataSources.DataTables.Item("dtData").Clear();

}

oDataTable = oForm.DataSources.DataTables.Item("dtData");

// Add Columns to Your SAPbouiCOM DataTable

oDataTable.Columns.Add("Col1", SAPbouiCOM.BoFieldsType.ft_Text, 20);

oDataTable.Columns.Add("Col2", SAPbouiCOM.BoFieldsType.ft_Text, 20);

//Add Row(s) to Your SAPbouiCOM DataTable

  oDataTable.Rows.Add(1);

              

  //Fill the Selected Row(s)

  oDataTable.SetValue("Col1", 0, "Some Value");

   oDataTable.SetValue("Col2", 0, "Some Value ");

          

  //Set Your DataTable to Your Grid

  Grid0.DataTable = oDataTable;

As you see from the code you can create your datatable as you want and you can set it to your grid object.

Grid also have a method called ExecuteQuery() method which makes you able to set your query result to a grid object

Regards,

Atilla

Former Member
0 Kudos

Hi Atila,

thankx I will try this. I wrote in some articles that the data table in a grid have to mach with the Table fields.

OK, but where is the Collapse in Matrix Object? I have not found this.

Regards

Oliver

former_member183373
Active Participant
0 Kudos

Hi Oliver,

I researched the subject again and looks like it is not possible to create collapse level with matrix object even though it has CollapsePressed events.

Sorry for the misinformation.

Regards,

Atilla

Former Member
0 Kudos

Hi Atila,

no Problem and Thanx for your Imput

Regards

Oliver