on 08-01-2011 7:56 PM
When loading a table from the database in a Matrix, I like this:
- I created the method of example "CreateFormWithMatrix."
- OItem oForm.Items.Add = ("Matrix1" SAPbouiCOM.BoFormItemTypes.it_MATRIX);
=-oColumns oMatrix.Columns;
oColumns.Add-oColumn = ("Code" SAPbouiCOM.BoFormItemTypes.it_EDIT);
oForm.DataSources.UserDataSources.Add-oUserDataSource = ("IntPhone" SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20);
oForm.DataSources.DBDataSources.Add-oDBDataSource = ("@ TB_TESTE");
- OColumn oColumns.Item = ("Code");
oColumn.DataBind.SetBound (true, "@ TB_TESTE", "Code");
-oMatrix.Clear ();
-oMatrix.AutoResizeColumns ();
-oDBDataSource.Query ();
-oUserDataSource.Value = "prefix";
-oMatrix.LoadFromDataSource ();
So fill the matrix with all data from my table.
How do I show in my matrix to only the data that filter through a select?
Example: Show the data in the matrix where the name is "Jesus."
Hello
You can fill matrix with a query, using datatable
You may try this sample
Dim oForm As SAPbouiCOM.Form = sbo_application.Forms.Add("MATRIXTEST")
oForm.Visible = True
oForm.Width = 300
oForm.Height = 400
oForm.DataSources.DataTables.Add("oMatrixDT")
oForm.DataSources.DataTables.Item("oMatrixDT").Clear()
Dim sSQL As String = "SELECT * FROM OQUT WHERE Name= 'Jesus' "
oForm.DataSources.DataTables.Item("oMatrixDT").ExecuteQuery(sSQL)
Dim oItem As SAPbouiCOM.Item = oForm.Items.Add("oMTX", SAPbouiCOM.BoFormItemTypes.it_MATRIX)
Dim oMatrix As SAPbouiCOM.Matrix = oItem.Specific
Dim oColumn As SAPbouiCOM.Column = oMatrix.Columns.Add("#", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "#"
oColumn = oMatrix.Columns.Add("1", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.DataBind.Bind("oMatrixDT", "Col1")
oColumn.TitleObject.Caption = "Customer Code"
oColumn = oMatrix.Columns.Add("2", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.DataBind.Bind("oMatrixDT", "DocEntry")
oColumn.TitleObject.Caption = "Quote Key"
oColumn = oMatrix.Columns.Add("3", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.DataBind.Bind("oMatrixDT", "NumAtCard")
oColumn.TitleObject.Caption = "Cust Ref Number"
oColumn = oMatrix.Columns.Add("4", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.DataBind.Bind("oMatrixDT", "DocDate")
oColumn.TitleObject.Caption = "Document Date"
oColumn.DisplayDesc = False
oMatrix.LoadFromDataSource()
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My method is this:
public void GetDataFromDataSource() {
// Ready Matrix to populate data
oMatrix.Clear();
oMatrix.AutoResizeColumns();
//oDBDataSource.Query();
SAPbouiCOM.Conditions oConditions;
SAPbouiCOM.Condition oCondition;
oConditions = new SAPbouiCOM.Conditions();
oCondition = oConditions.Add();
oCondition.BracketOpenNum = 2;
oCondition.Alias = "U_ItemOne";
oCondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
oCondition.CondVal = "Teste";
oCondition.BracketCloseNum = 1;
//oCondition.Relationship = SAPbouiCOM.BoConditionRelationship.cr_OR;
oDBDataSource = oForm.DataSources.DBDataSources.Item("@TB_TESTE");
oDBDataSource.Query(oConditions);
oUserDataSource.Value = "Phone with prefix";
oMatrix.LoadFromDataSource();
}
When you execute them brings my empty matrix. Can I do this operation on tables that have the type of object? Or only on tables without object type? What was wrong?
User | Count |
---|---|
86 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.