Fill matrix with datasource

Hi,
i created an empty matrix on a form and i am trying to fill data in it with recordset ans userdatsource.
I tested my recrdset query and it is working but my matrix want show me data when the form is loaded.
this is my code :
public static void FillUserDataSource()
            Globals.TestRecordSet = (SAPbobsCOM.Recordset)    Globals.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            Globals.TestRecordSet.DoQuery(("SELECT DocNum,ORDR.CardCode,City FROM ORDR,OCRD WHERE ORDR.CardCode=OCRD.CardCode"));
            if (Globals.TestRecordSet.RecordCount != 0)
                Globals.TestRecordSet.MoveFirst();
                while (!Globals.TestRecordSet.EoF)
                    for (int i = 0; i < 3; i++)
                        Globals.TestForm.DataSources.UserDataSources.Item(i).ValueEx = (string)Globals.TestRecordSet.Fields.Item(i).Value;
                    Globals.ComMatrix.AddRow(1,0);
                    Globals.TestRecordSet.MoveNext();
Thanks for your help.

hi,
i tried your code and it is the same it wont display.
i ll show you all my code .
using System;
using System.Collections.Generic;
using System.Text;
namespace FormsTest
    public class FormOp
        public FormOp(string filename, string formid)
            DrawForm(filename, formid);
            AddDatasourceToForm();
            DataBindToForm();
            FillUserDataSource();
        public static void DrawForm(string filename, string formid)
            XmlOperations.LoadFromXml(filename);
            try
                Globals.TestForm = Globals.sboApplication.Forms.Item(formid);
            catch (Exception e)
                Globals.sboApplication.MessageBox(e.Message, 1, "OK", "", "");
            Globals.TestItem = Globals.TestForm.Items.Item("dteliv");
            Globals.DatLivText = (SAPbouiCOM.EditText)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("pcom");
            Globals.PoidCom = (SAPbouiCOM.EditText)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("pcomrest");
            Globals.PoidComRestant = (SAPbouiCOM.EditText)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("pchar");
            Globals.PoidChar = (SAPbouiCOM.EditText)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("pcharrest");
            Globals.PoidCharRestant = (SAPbouiCOM.EditText)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("matcom");
            Globals.ComMatrix = (SAPbouiCOM.Matrix)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("matcom1");
            Globals.Com1Matrix = (SAPbouiCOM.Matrix)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("matstock");
            Globals.StockMatrix = (SAPbouiCOM.Matrix)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("matstock1");
            Globals.Stock1Matrix = (SAPbouiCOM.Matrix)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("matveh");
            Globals.VehiculMatrix = (SAPbouiCOM.Matrix)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("matveh1");
            Globals.Vehicul1Matrix = (SAPbouiCOM.Matrix)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("creeliv");
            Globals.CreerLiv = (SAPbouiCOM.Button)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("interr");
            Globals.Interr = (SAPbouiCOM.Button)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("NComCol");
            Globals.NComCol = (SAPbouiCOM.Column)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("NomClCol");
            Globals.NomClCol = (SAPbouiCOM.Column)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("PoComCol");
            Globals.PoComCol = (SAPbouiCOM.Column)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("VilLivCol");
            Globals.VilLivCol = (SAPbouiCOM.Column)Globals.TestItem.Specific;
            Globals.TestItem = Globals.TestForm.Items.Item("VolComCol");
            Globals.VolComCol = (SAPbouiCOM.Column)Globals.TestItem.Specific;
        public static void AddDatasourceToForm()
            SAPbouiCOM.UserDataSource oUserDataSource;
            oUserDataSource = Globals.TestForm.DataSources.UserDataSources.Add("ComDataSource", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20);
        public static void DataBindToForm()
            Globals.NomClCol.DataBind.SetBound(true, "", "ComDataSource");
            Globals.NomClCol.DataBind.SetBound(true, "", "ComDataSource");
            Globals.VilLivCol.DataBind.SetBound(true, "", "ComDataSource");
            Globals.PoComCol.DataBind.SetBound(true, "", "ComDataSource");
            Globals.VolComCol.DataBind.SetBound(true, "", "ComDataSource");
        public static void FillUserDataSource()
            Globals.TestRecordSet = (SAPbobsCOM.Recordset)Globals.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            Globals.TestRecordSet.DoQuery(("SELECT DocNum,ORDR.CardCode,City FROM ORDR,OCRD WHERE ORDR.CardCode=OCRD.CardCode"));
            if (Globals.TestRecordSet.RecordCount != 0)
                Globals.TestRecordSet.MoveFirst();
                while (!Globals.TestRecordSet.EoF)
                    Globals.ComMatrix.AddRow(1, 0);
                    for (int i = 0; i < 3; i++)
                        Globals.TestForm.DataSources.UserDataSources.Item(i).ValueEx = (string)Globals.TestRecordSet.Fields.Item(i).Value;
                    Globals.ComMatrix.SetLineData(Globals.ComMatrix.RowCount);
                    Globals.TestRecordSet.MoveNext();

Similar Messages

  • How to fill matrix with the output of recordset query?

    Hi all,
    I want a user matrix to load data when I hit a button and the data to be filled is the output of an sql query. binding the matrix columns with table columns and then load the matrix with DBDatasource attached to that table will not do in this case as the columns in the sql query are from several different tables or views. 
    writing following line to do this takes several minutes to load the data:
    For j = 0 To Reordset.RecordCount - 1
    Matrix.AddRow()
    Matrix.Columns.Item("col1").Cells.Item(i).Specific.value =  Recordset.Fields.Item("cardcode").Value
    Recordset.movenext()
    next
    Is there any other way to fill the matrix in this case, which loads the data faster?
    Regards,

    Hello Binita,
    I've tested the CFL for DataTable-Matrixes in my test-AddOn. But there's still one problem left. Maybe you find it out (I will need this in the future too...).
    The ChooseFromList must be added behind the DataTable-Bind, which is done on every MTX-Load (it's not from the sample above, so the UIDs are new ones):
                oDt = oDts.Item("dt_test")
                query = "SELECT  * FROM [@T_CONVTOOLS01]"
                oDt.ExecuteQuery(query)
                oMtx.Columns.Item("0").DataBind.Bind("dt_test", "Code")
                oMtx.Columns.Item("1").DataBind.Bind("dt_test", "U_Alpha01")
                oMtx.Columns.Item("2").DataBind.Bind("dt_test", "U_Price01")
                oMtx.Columns.Item("3").DataBind.Bind("dt_test", "U_Quant01")
                oMtx.Columns.Item("4").DataBind.Bind("dt_test", "U_Date01")
                AddChooseFromLists()
                oMtx.LoadFromDataSource()
    ...where AddChooseFromLists() is...
      Private Shared Sub AddChooseFromLists()
            Try
                Dim oCfls As SAPbouiCOM.ChooseFromListCollection
                Dim oCons As SAPbouiCOM.Conditions
                Dim oCon As SAPbouiCOM.Condition
                Dim oCfl As SAPbouiCOM.ChooseFromList
                Dim oCflCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                Dim oBtn As SAPbouiCOM.Button
                Dim oMtx As SAPbouiCOM.Matrix
                Dim oCol As SAPbouiCOM.Column
                Dim oEtx As SAPbouiCOM.EditText
                oMtx = oForm.Items.Item("MTX_TEST02").Specific
                oCfls = oForm.ChooseFromLists
                oCflCreationParams = SboCon.SboUI.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                oCflCreationParams.MultiSelection = False
                oCflCreationParams.ObjectType = SAPbouiCOM.BoLinkedObject.lf_BusinessPartner
                oCflCreationParams.UniqueID = "CFL_C1"
                oCfl = oCfls.Add(oCflCreationParams)
                '### OPTION:
                '# Shown ChooseFromList restricted by Conditions
                oCons = oCfl.GetConditions()
                oCon = oCons.Add()
                oCon.Alias = "CardType"
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                oCon.CondVal = "C"
                oCfl.SetConditions(oCons)
                oCol = oMtx.Columns.Item("1")
                oCol.ChooseFromListUID = "CFL_C1"
                oCol.ChooseFromListAlias = "CardCode"
            Catch e As Exception
                Microsoft.VisualBasic.MsgBox(className & ".AddChooseFromLists()" & vbCrLf & "Exception:" & vbCrLf & e.Message.ToString)
            End Try
        End Sub
    But I'm running into problems when trying to set the MTX-Cell via DataTable at the CFL-Event (see comment):
                If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                    Dim oMtx As SAPbouiCOM.Matrix
                    Dim oCFLEvent As SAPbouiCOM.IChooseFromListEvent
                    Dim oCFL As SAPbouiCOM.ChooseFromList
                    Dim oDataTable As SAPbouiCOM.DataTable
                    Dim cflID As String
                    Dim oDt As SAPbouiCOM.DataTable = oForm.DataSources.DataTables.Item("dt_test")
                    oCFLEvent = pVal
                    cflID = oCFLEvent.ChooseFromListUID
                    'Dim oForm As SAPbouiCOM.Form
                    'oForm = SboConnection.SboUI.Forms.Item(FormUID)
                    oCFL = oForm.ChooseFromLists.Item(cflID)
                    If Not oCFLEvent.BeforeAction Then
                        oDataTable = oCFLEvent.SelectedObjects
                        If oDataTable Is Nothing Then Exit Sub
                        '############## Matrix Test #######################################################################
                        If (oCFLEvent.ItemUID = "MTX_TEST02") Then
                            oMtx = oForm.Items.Item("MTX_TEST02").Specific
                            '### CFL Results to UserForm
                            oDt.Rows.Offset = oCFLEvent.Row - 1
                            MsgBox(oDt.GetValue("U_Alpha01", oCFLEvent.Row - 1))
                            MsgBox(oDataTable.GetValue("CardCode", 0))
                            ' PROBLEM - can't get this working - don't know at the moment:
                            ' on other forms SetValue works....
                            oDt.SetValue("U_Alpha01", oCFLEvent.Row - 1, oDataTable.GetValue("CardCode", 0))
                            ' this also gives me problems...:
                            'oMtx.Columns.Item("1").Cells.Item(oCFLEvent.Row).Specific.value = oDataTable.GetValue("CardCode", 0)
                            oForm.Update()
                        End If
                    End If
                End If
    The CFL-Form opens and returns the choosen value(s) at the CFL-event. But writing to MTX still not works with this code...
    Maybe you find the last piece. If so: please write here.
    Cheers,
    Roland
    p.s.:
    David Nussböck wrote
    LOL - ROLAND WAS FASTER ))
    ...just one minute...

  • Filling matrix with Dummy Data

    I am doing a demo screen for a client and I need to fill a matrix with hard coded data. I followed the sample code and I have the following code but it is not working for me (it throws a matrix-line exists exception):
    // Now get the matrix Item.
    SAPbouiCOM.Item matrixItem  = oForm.Items.Item("v33_Grid");
    theMatrix = (SAPbouiCOM.Matrix) matrixItem.Specific;
    Form.Freeze(true);
    SAPbouiCOM.UserDataSource uds;
    uds = oForm.DataSources.UserDataSources.Add("salesUds",SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 10);
    theMatrix.AddRow(1, theMatrix.RowCount);
    SAPbouiCOM.Column     col      = null;
    // Ready Matrix to populate data
    theMatrix.AutoResizeColumns();
    col = theMatrix.Columns.Item("desc1");
    col.DataBind.SetBound(true, "", "salesUds");
    uds.Value = "Test description";
    // setting the user data source data
    theMatrix.LoadFromDataSource();
    oForm.Freeze(false);
    oForm.Update();     
    I really need to get this working. ANyone got any ideas what I am doing wrong?

    Hi Laura,
    You should use theMatrix.SetLineData() which is the avaiable statement for user matrixes.
    Here is some code that loads a form with a matrix from an XML. This way you can edit form values in the XML, instead of hard coding.
    Dim oXMLDoc1 As Xml.XmlDocument = New Xml.XmlDocument
    oXMLDoc1.Load("C:BaseForm.xml")
    App.LoadBatchActions(oXMLDoc1.InnerXml)
    Dim oForm As SAPbouiCOM.Form = App.Forms.GetForm("ITA0002", 1)
    Dim oMatrix As SAPbouiCOM.Matrix = oForm.Items.Item("5").Specific()
    Dim Informes As SAPbouiCOM.UserDataSource = oForm.DataSources.UserDataSources.Item("Informes")
    Dim ID As SAPbouiCOM.UserDataSource = oForm.DataSources.UserDataSources.Item("ID")
    Dim i As Int16 = 1
    oMatrix.AddRow(ListaInformes.Length)
    For Each Informe As String In NameList
       Informes.ValueEx = Informe
       ID.ValueEx = i.ToString
       oMatrix.SetLineData(i)
       i = i + 1
    Next
    The xml is this one:
    <?xml version="1.0" encoding="UTF-16"?>
    <Application>
         <forms>
              <action type="add">
                   <form AutoManaged="1" BorderStyle="4" FormType="ITA0002" ObjectType="-1" SupportedModes="1" appformnumber="ITA0002" client_height="284" client_width="291" color="0" default_button="1" height="316" left="363" mode="1" pane="1" title="Informes" top="149" type="4" visible="1" width="297">
                        <datasources>
                             <userdatasources>
                                  <action type="add">
                                       <datasource size="254" type="9" uid="Informes"></datasource>
                                  </action>
                                  <action type="add">
                                       <datasource size="10" type="9" uid="ID"></datasource>
                                  </action>
                             </userdatasources>
                        </datasources>
                        <items>
                             <action type="add">
                                  <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="0" from_pane="0" height="19" left="6" linkto="" right_just="1" supp_zeros="0" tab_order="10" text_style="0" to_pane="0" top="260" type="4" uid="1" visible="1" width="65">
                                       <AutoManagedAttribute></AutoManagedAttribute>
                                       <specific caption="OK"></specific>
                                  </item>
                                  <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="0" from_pane="0" height="19" left="77" linkto="" right_just="1" supp_zeros="0" tab_order="20" text_style="0" to_pane="0" top="260" type="4" uid="2" visible="1" width="65">
                                       <AutoManagedAttribute></AutoManagedAttribute>
                                       <specific caption="Cancelar"></specific>
                                  </item>
                                  <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="-1" from_pane="0" height="20" left="5" linkto="" right_just="0" supp_zeros="0" tab_order="0" text_style="0" to_pane="0" top="5" type="99" uid="3" visible="1" width="80">
                                       <AutoManagedAttribute></AutoManagedAttribute>
                                       <specific AffectsFormMode="1" caption="Informes" val_off="0" val_on="1">
                                            <databind alias="Informes" databound="1" table=""></databind>
                                       </specific>
                                  </item>
                                  <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="-1" from_pane="1" height="224" left="8" linkto="" right_just="0" supp_zeros="0" tab_order="60" text_style="0" to_pane="1" top="28" type="127" uid="5" visible="1" width="276">
                                       <AutoManagedAttribute></AutoManagedAttribute>
                                       <specific SelectionMode="2" layout="0" titleHeight="0">
                                            <columns>
                                                 <action type="add">
                                                      <column AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" editable="0" font_size="12" forecolor="-1" right_just="0" text_style="0" title="2" type="16" uid="2" val_off="N" val_on="Y" visible="1" width="20">
                                                           <databind alias="ID" databound="1" table=""></databind>
                                                           <ExtendedObject></ExtendedObject>
                                                      </column>
                                                      <column AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" editable="0" font_size="12" forecolor="-1" right_just="0" text_style="0" title="Nombre" type="16" uid="1" val_off="" val_on="" visible="1" width="255">
                                                           <databind alias="Informes" databound="1" table=""></databind>
                                                           <ExtendedObject></ExtendedObject>
                                                      </column>
                                                 </action>
                                            </columns>
                                       </specific>
                                  </item>
                             </action>
                        </items>
                        <items>
                             <action type="group">
                                  <item uid="3"></item>
                                  <item uid="4"></item>
                             </action>
                        </items>
                        <FormMenu></FormMenu>
                        <DataBrowser></DataBrowser>
                   </form>
              </action>
         </forms>
    </Application>
    Regards,
    Ibai Peñ

  • DI UI : fill matrix with a query from user table data

    hello,
    I create a user table.
    I want to fill a matrix on a form with some aggregated data of this user table.
    I do :
    Public Sub SetMatrixRep()
      Dim oRecordSet As SAPbobsCOM.Recordset
      Dim oCentre As SAPbouiCOM.EditText
      Dim oCompte As SAPbouiCOM.EditText
      Dim oBudget As SAPbouiCOM.EditText
      Dim oDepense As SAPbouiCOM.EditText
      Dim oSolde As SAPbouiCOM.EditText
      Dim i As Long
      i = 0
      Set oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
      oRecordSet.DoQuery ("select * from [@CAP_OPRC_BUDGET]")
      While oRecordSet.EOF = False
        ' filling the matrix
        Set oCentre = oMatrixRep.Columns("clCentre").Cells.Item(i).Specific
        oCentre.String = oRecordSet.Fields.Item(0).Value
        'oMatrixRep.Columns("clCentre").Cells(1).Specific.String = oRecordSet.Fields.Item(0).Value
        'SBO_Application.MessageBox (oRecordSet.Fields.Item(0).Value)
        oMatrixRep.AddRow
        oRecordSet.MoveNext
        i = i + 1
      Wend
    End Sub
    I've got an error : Row - Index invalid.
    Could you help me please ?
    Thanks.
    Romeo.

    Hi
    This is a routine that I call from my Item Event handler
    Hope it can help you
    Public Sub PopolaMatrice(oApplicazione As SAPbouiCOM.Application, pVal As SAPbouiCOM.IItemEvent)
        Dim oForm               As SAPbouiCOM.Form
        Dim oMatrix             As SAPbouiCOM.Matrix
        Dim oDBDataSource       As SAPbouiCOM.DBDataSource
        Dim oConditions         As New SAPbouiCOM.Conditions
        Dim oCondition          As SAPbouiCOM.Condition
        Dim oDocNum             As SAPbouiCOM.EditText
        Dim lIndice             As Long
        Set oForm = oApplicazione.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
        Set oDBDataSource = oForm.DataSources.DBDataSources.Item("MyUserTableName")
        Set oMatrix = oForm.Items("MyMatrixName").Specific
        oMatrix.Clear
        'setting the condition object
        'this is equal to the following SQL statement
        'WHERE UserFieldName1 = "MyCriteria1" and UserFieldName2 = "MyCriteria2"
        Set oCondition = oConditions.Add()
        oCondition.BracketOpenNum = 2
        oCondition.Alias = "UserFieldName1"
        oCondition.Operation = co_EQUAL
        oCondition.CondVal = "MyCriteria1"
        oCondition.BracketCloseNum = 1
        oCondition.Relationship = cr_AND
        Set oCondition = oConditions.Add()
        oCondition.BracketOpenNum = 1
        oCondition.Alias = "UserFieldName2"
        oCondition.Operation = co_EQUAL
        oCondition.CondVal ="MyCriteria2"
        oCondition.BracketCloseNum = 2
        oDBDataSource.Query oConditions
        'filling the matrix
        For lIndice = 0 To oDBDataSource.Size - 1
            oDBDataSource.Offset = lIndice
            oMatrix.AddRow
        Next lIndice
    End Sub

  • Fill matrix with query

    Hi,
    I have a query that I want to display in a matrix. The query is based on the tables: OINV, INV1, OITM, OCRD. I would like to know what is the best way to bind this query to a matrix? Should I create a recordset with the query and iterate it and fill the matrix line by line and column by columns, or can I use something like a datasource with query (even if there are more than one table) and bind it?
    And also, can I create this query using the DI API (I haven't worked with it so far) or do I have to create it myself (my own SELECT)?
    Thank you so much,
    Irina

    hi,
    create one temporary table called TEMP with all necessary fields which u r going to insert in Matrix.
    Use the following code.
    delete the existing values in @TEMP table
    RS = Nothing
                    RS = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                    RS.DoQuery("Select * from OITM,OITW,ITT1 where Conditions")
    For i as integer = 1 To RS.RecordCount
    RS1 = Nothing
    RS1 = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
    RS1.DoQuery("INSERT INTO [@TEMP](DocEntry,U_X,U_Y,U_Z)values(" & i & "," & RS.Fields.Item("ItemCode").Value & "','" & RS.Fields.Item("Quantity").Value & "','" & RS.Fields.Item("UoM").Value & "')")
    End If
                    DSource = Nothing
                    oMatrix = oForm.Items.Item("MatrixUID").Specific
                    oColumns = oMatrix.Columns
                    DSource = oForm.DataSources.DBDataSources.Add("@TEMP")
                    oColumn = oColumns.Item("0") ' # Column
                    oColumn.DataBind.SetBound(True, "@TEMP", "DocEntry")
                    oColumn = oColumns.Item("1")
                    oColumn.DataBind.SetBound(True, "@TEMP", "U_X")
                    oColumn = oColumns.Item("2")
                    oColumn.DataBind.SetBound(True, "@TEMP", "U_Y")
                    oColumn = oColumns.Item("3")
                    oColumn.DataBind.SetBound(True, "@TEMP", "U_Z")
                    oMatrix.Clear()
                    oMatrix.AutoResizeColumns()
                    DSource.Query()
                    oMatrix.LoadFromDataSource()
    or u can use a virtual data source table.this is better.
    oForm.DataSources.DataTables.Add("TEMP") 'Virtual data table. You can use as is.
    Dim SQLSTR as String  = "SELECT fields FROM tables WHERE Conditions"
    oForm.DataSources.DataTables.Item("TEMP").ExecuteQuery(SQLSTR )
                    DSource = Nothing
                    oMatrix = oForm.Items.Item("MatrixUID").Specific
                    oColumns = oMatrix.Columns
                    oColumn = oColumns.Item("1")
                    oColumn.DataBind.SetBound(True, "TEMP", "U_X")
                    oColumn = oColumns.Item("2")
                    oColumn.DataBind.SetBound(True, "TEMP", "U_Y")
                    oColumn = oColumns.Item("3")
                    oColumn.DataBind.SetBound(True, "TEMP", "U_Z")
                    oMatrix.Clear()
                    oMatrix.AutoResizeColumns()
                    DSource.Query()
                    oMatrix.LoadFromDataSource()
    regards,
    varma
    Edited by: Varma on Oct 18, 2008 9:53 AM

  • Load Matrix with Select

    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

  • How to fill column value of a matrix with specific color when there is no value in that specific cell?

    Hi All,
    I need to create a 5/5  matrix in SSRS report. The data will be :
    Col_Side   Col_Header   Col_data
    1                  1                1
    1                  1                 1
    1                  2                1
    1                  5                1
    1                  5                1
    1                  5                1
    2                  3                1
    2                  5                1
    3                  1                2
    3                  1                2
    3                  1                2
    4                   2               1
    4                   4               1
    5                   1               1
    5                   1               1
    5                   5               1
    So, the matrix column will be Col_Header and matrix row will be Col_Side and count(Col_data) will be on the data.
    Finally, it will create a 5 by 5 matrix with Count(Col_data) as its data for each combinations. If there is no combination (for ex: in the above data we do not have no combination of (1,3) , (1,4) , (2,1) etc..) then the matrix will be filling that corresponding
    cell with zero.
    Here I need to fill the cells with some colors based on some criteria.
    I need to fill (5,3), (5,4), (5,5) combination with "Red" color.  Like this , I need to give different colors in each of the cells. Here, (5,5) combination will be having 1 in its cell.  (5,4) and (5,3) will be having zero in its corresponding
    cells. I 'm trying to fill all the 3 cells with "Red" color. But, I am able to fill only (5,5) with "Red" color. Since the other 2 cells (5,3) and (5,4), has zero in their cells, it will not fill the cells with "Red" color. 
    How can I fill those two cells (5,3) and (5,4) with red color?
    I know this is very vague. I have no option to give the picture here..
    Please suggest

    Hi Julie,
    According to your description, there is a 5/5 matrix with three fields: Col_Side, Col_Header, Col_data. You drag Col_Side field to Rows, Col_Header to Columns and Col_data to Data, then filling blank cells with zero using expression. Now you want to fill 
    (5,3), (5,4), (5,5) cells with red color using expression, but it has no effect on cells (5,3) and (5,4).
    According to my test, the expression has on effect on cells (5,3) and (5,4) since there is no corresponding data and the cells are blank. As a workaround, we can insert data for cells (5,3) and (5,4) in dataset, then use expression by following steps:
    In the dataset, insert two sets of data (5,3,0), (5,4,0).
    Right-click the cell of data, click Text Box Properties.
    Click Fill in left pane, click (fx) button, then type the expression like below, then click OK.
    =iif(Fields!Col_Side.Value=5 and Fields!Col_Header.Value >=3 ,"red","white" )
    The following screenshot is for your reference:
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu

  • How to fill the first column '#' of matrix  with row id in user form?

    Hi All,
    I am having a user defined form in which, I m having a matrix and m populating the matrix with the output of an sql query.
    something like this:
    SQL_Str= "select col1,col2,......from.... "
    OPopDBTable.ExecuteQuery(SQL_Str)
    oMatrix.AddRow()
    oMatrix.Columns.Item("Col3").DataBind.Bind("PopTable", "col1")
    oMatrix.Columns.Item("Col2").DataBind.Bind("PopTable", "col2")
    oMatrix.LoadFromDataSource()
    Now, in this, how can I assign row number to first column ('#' column ) ??
    regards,
    Binita

    Ah...the ROW_NUMBER() was posted by Petr - also thank you (again)
    With my example-query from the other thread:
    SELECT
         CAST(
                 ROW_NUMBER() OVER (ORDER BY T1.U_LogNo ASC) AS INT
            ) AS RowCnt,
         T1.Code,
         T1.U_ParcelNo,
         T1.U_LogNo
    FROM
         [@XXX_EXAMPLE] T1
    WHERE
         T1.U_ParcelNo='132006' 
    ORDER BY
         T1.U_LogNo ASC
    ...this works for me (it's quickly copied from several subs/func. - I hope it's not too much disordered):
    DtLogs.ExecuteQuery(query)
    oMtxLogs.Columns.Item("0").DataBind.Bind("DT_LOGS", "RowCnt")
    oMtxLogs.Columns.Item("1")........
    oMtxLogs.LoadFromDataSource()

  • Load System Matrix with Data

    Hi,
    I like to fill system Matrix with data; please find the code below.
    Thank you very much for your good work and support.
    Thank you,
    Rune
    CODE
    #region SalesOrderItemLine_GetDataFromDataSource
    public void SalesOrderItemLine_GetDataFromDataSource( SAPbouiCOM.Form oForm, bool Matrix77_AddRefresh )
         try
              if ( Matrix77_AddRefresh )
    oForm.DataSources.DataTables.Add("SYS_77");
              oForm.DataSources.DataTables.Item("SYS_77").ExecuteQuery("SELECT [Code],[Name],[U_Weight],[U_PoNo],[U_CoopName],[U_Consignee],[U_PalGroup],[U_Container],[U_ItemCode],[U_CheckBoxSelect] FROM [dbo].[@MyTable] WHERE [U_MatrixAorB] = 'A' AND [U_WRKsalesOrderYN] = 'N'");
              ( ( SAPbouiCOM.Matrix ) ( oForm.Items.Item("77").Specific ) ).Columns.Item("1").DataBind.Bind("SYS_77", "U_ItemCode");
              ( ( SAPbouiCOM.Matrix ) ( oForm.Items.Item("77").Specific ) ).Clear();
              ( ( SAPbouiCOM.Matrix ) ( oForm.Items.Item("77").Specific ) ).LoadFromDataSource();
              ( ( SAPbouiCOM.Matrix ) ( oForm.Items.Item("77").Specific ) ).AutoResizeColumns();
         catch ( Exception Error )
              oApplication.MessageBox("Add-On Error-3232: = " + Error.Message, 1, "Ok", "", ""); // My Error Code
    #endregion

    Hi David!
    This is a Product Development Collaboration suggestion!
    I like to load data into system matixes...that could be really nice!
    (No my problem is still out there...
    Thank you,
    Rune

  • Matrix with DataTable - GetLineData and SetLineData B1 8.8 Bug

    Hi experts,
    I have a matrix bounded to a DataTable and I succefully load the matrix with:
    DataTable dt = form.DataSources.DataTables.Item("matDT");
    dt.ExecuteQuery(sql);
    Matrix mat = form.Items.Item("mat").Specific as Matrix;
    mat.LoadFromDataSource();
    mat.AutoResizeColumns();
    Now in Event et_VALIDATE(after), i would like to change some not editable column of the matrix
    [B1Listener(BoEventTypes.et_VALIDATE, false)]
    public virtual void OnAfterValidate(ItemEvent pVal) {
              if(pVal.ItemUID!="mat")
                    return;
              Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
              Matrix mat = form.Items.Item("mat").Specific as Matrix;
              DataTable dt = form.DataSources.DataTables.Item("matDT");
              //Pont 1)
              mat.GetLineData(pVal.Row)     
              //Point 2
              //Change Values
              int minutes = dt.GetValue("U_Minutes", pVal.Row-1);
              dt.SetValue("U_Hours",pVal.Row-1, (double) minutes / 60);
              //Point 3
              mat.SetLineData(pVal.Row);
    Now I will expain the problem:
    For simplicity assume the matrix has 2 rows after load. After the user edit a column, validate event fires and:
    -) After the call of GetLineData  in Point 1) I verified that all DataTable Rows are identical (derived from the first row in the matrix)
    -) If I substitute GetLineData   in point 1) with FlushToDataSource, DataTable became corret but after the call of SetLineData in point 3) all the matrix rows are identical (derived from the first DataTable row).
    -) If I also substitute SetLineData   in point 3) with LoadFromDataSource, all works fine but i loose focus and performances
    Is it a B1 8.8 Bug?

    Yes, but sap said that my  customer is not officially approved.
    the following is the original text.
    Please note that SAP Business One Release 8.8 has only been released for
    Ramp-Up. Because of this, only approved projects for productive usage a
    re fully supported by SAP Business One Support. However feedback on prod
    uct quality or bugs reporting from all partners - even from partners who
    are not part of the Ramp-Up - is welcome and highly appreciated.
    According to the information we have, your customer is not officially ap
    proved for Ramp-Up yet. Due to the difficulty to estimate the number of
    messages that will be submitted, SAP cannot commit itself to solving all
    issues reported about projects not officially approved for Ramp-Up, nor
    guarantee any response times.
    Kind regards,
    SAP Business One Support

  • DateField not getting copy in the matrix using Datasource & Datatable

    Hello All,
    I have tried to copy data From Purchase Order Tables to my own created User Defined Form matrix columns using DBDatasource & Datatables ,Instead of Document Date all other data are getting copied but that document date field is not
    getting the data plus it is not showing any error message as such.
    Following is the code which i have written :-
    =====================================
    oPurchase_Amend.DataSources.DataTables.Add("oMatrixDT" )
    oPurchase_Amend.DataSources.DataTables.Item("oMatrixDT" ).Clear()
    Dim sSQL As String = "SELECT T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[Price],(Select InvntryUoM From OITM Where ItemCode=T1.ItemCode) as 'UoM',T1.LineNum,T0.DocNum  as 'FrmDate' FROM OPOR T0  INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.[DocNum] ='1' and T0.CardCode='C0001'
    oPurchase_Amend.DataSources.DataTables.Item("oMatrixDT" ).ExecuteQuery(sSQL)
    oMatrix = oPurchase_Amend.Items.Item("mtx_0").Specific
    oMatrix.Clear()
    Dim oDBDataSource As SAPbouiCOM.DBDataSource = oPurchase_Amend.DataSources.DBDataSources.Item("@OSL_POAMD")
    Dim oDataTable As SAPbouiCOM.DataTable = oPurchase_Amend.DataSources.DataTables.Item("oMatrixDT" )
    oDBDataSource.Clear()
    For row As Integer = 0 To oDataTable.Rows.Count - 1
    Dim offset As Integer = oDBDataSource.Size
    oDBDataSource.InsertRecord(row)
    oDBDataSource.SetValue("U_ItemCode", offset, oDataTable.GetValue("ItemCode", row).ToString())
    oDBDataSource.SetValue("U_ItemName", offset, oDataTable.GetValue("Dscription", row).ToString())
    oDBDataSource.SetValue("U_UoM", offset, oDataTable.GetValue("UoM", row).ToString())
    oDBDataSource.SetValue("U_OldQty", offset, oDataTable.GetValue("Quantity", row).ToString())
    oDBDataSource.SetValue("U_OldRate", offset, oDataTable.GetValue("Price", row).ToString())
    > Line For Copying Document Date Data to the matrix datasource
    oDBDataSource.SetValue("U_OldDate", offset, oDataTable.GetValue("FrmDate", row))
    oDBDataSource.SetValue("U_LineId", offset, oDataTable.GetValue("LineNum", row))
      Next
    '--- Rebinding the datasource to the matrix columns -
    oMatrix.Columns.Item("col_0").DataBind.SetBound(True, "@OSL_POAMD", "U_ItemCode")
    oMatrix.Columns.Item("col_1").DataBind.SetBound(True, "@OSL_POAMD", "U_ItemName")
    oMatrix.Columns.Item("col_3").DataBind.SetBound(True, "@OSL_POAMD", "U_OldQty")
    oMatrix.Columns.Item("col_5").DataBind.SetBound(True, "@OSL_POAMD", "U_OldRate")
    oMatrix.Columns.Item("col_7").DataBind.SetBound(True, "@OSL_POAMD", "U_OldDate")
    oMatrix.Columns.Item("col_9").DataBind.SetBound(True, "@OSL_POAMD", "U_LineId")
    oMatrix.LoadFromDataSource()
    But i am not able to get the document date in the column of the matrix .
    Please suggest what changes i have to meke in this code to get the desired output.
    Thanks & Regards,
    Amit
    Edited by: AmitSharma_061985 on Dec 17, 2009 12:24 PM

    Hi Michael,
    FrmDate is the Document date of the purchase order which i am fetching through sql query and trying to copy that in the matrix
    through datasource .
    Edited by: AmitSharma_061985 on Dec 18, 2009 7:07 AM

  • How do I create a shortcut to fill cells with the same background colour

    I have recently starting using Numbers, being an Excel user for years.
    I often fill cells with a yellow background to highlight them.
    In Excel you can do this from a simple colour menu in the toolbar at the top.
    I have found no quick and easy way to do this in Numbers.
    Any advice would be appreciated.
    thank you

    As far as I can tell there's no direct equivalent of the little paintbucket button in Excel that remembers the last colour you filled with.
    One quick and relatively easy way to achieve it would be with an AppleScript:
    tell application "Numbers" to tell front document to tell active sheet
      try
      set active_table to (first table whose class of selection range is range)
      on error
      display alert "No selection" buttons {"OK"} default button 1
      return
      end try
      tell active_table
      set background color of selection range to {62466, 65535, 28003}
      end tell
    end tell
    This could be run from Numbers' script menu (screen grab below) or saved as an Automator Service and run from a popup or keyboard shortcut (eg ctrl-y).
    Post back if you'd like to follow up either of those ideas.

  • Uncheck "Fill screen with one page at a time"

    Is it possible to set a javascript to turn off the preference "Fill screen with one page at a time" when entering in Full Screen mode? So that way, it will override Acrobat or Reader application preferences when the PDF is open on users computers.

    Everything that's supported is documented here: http://livedocs.adobe.com/acrobat_sdk/11/Acrobat11_HTMLHelp/JS_API_AcroJS.89.768.html
    Unfortunately, what you want isn't supported.

  • How to create Matrix with Group report layout in xml

    Hi,
    i would be glad if anyone could tell me How to create Matrix with Group report layout in xml?
    Here i am attaching the required design doc
    below is the code
    select COST_CMPNTCLS_CODE,
    -- crd.RESOURCES,
    NOMINAL_COST,
    cmm.COST_MTHD_CODE,
    -- crd.COST_TYPE_ID,
    gps.period_code
    -- ORGANIZATION_ID
    from CM_RSRC_DTL crd,
    gmf_period_statuses gps,
    CM_MTHD_MST cmm,
    CR_RSRC_MST crm,
    CM_CMPT_MST ccm
    where gps.period_id = crd.PERIOD_ID
    and crd.cost_type_id = cmm.cost_type_id
    and crd.RESOURCES = crm.RESOURCES
    and crm.COST_CMPNTCLS_ID = ccm.COST_CMPNTCLS_ID
    and gps.period_code in (:p_period1, :p_period2, :p_period3)
    group by COST_CMPNTCLS_CODE, cmm.COST_MTHD_CODE, gps.period_code,NOMINAL_COST
    order by 1,2,3,4.
    The o/p of the report shoud be as given below
              Period-1     Period-2     Period-3     Period-4
    COMPONENT                         
    LABOUR - DIRECT                         
         Actual     1     2     3     4
         Actual Rate     10     10     10     10
         Standard Rate                    
         Var%                    
    DEPRICIATION-DIRECT                         
         Actual                    
         Actual Rate                    
         Standard Rate                    
         Var%                    
    OVERHEAD - DIRECT                         
         Actual                    
         Actual Rate                    
         Standard Rate                    
         Var%                    
    LABOUR - IN DIRECT                         
         Actual                    
         Actual Rate                    
         Standard Rate                    
         Var%                    
    Thanks in advance

    Your friend is obviously not a reliable source of HTML
    information.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Mr.Ghost" <[email protected]> wrote in
    message
    news:f060vi$npp$[email protected]..
    > One of my friends advised me to develop my whole site on
    the layout mode
    > as its
    > better than the standard as he says
    > but I couldnot make an ordinary table with rows and
    columns in th layout
    > mode
    > is there any one who can tell me how to?
    > thanx alot
    >

  • How to build a Matrix with Group Left Report

    I want to build a Matrix with Group Left Report,not Matrix with Group Above Report,i am still finding the solution, any help is useful.
    thanks
    <[email protected]>

    Hi,
    The problem in your output is not clear. The report output should appear like:
    Order Mode.....Sales_Rep_ID > 10..11..12..
    Online.........Order Status
    ...............A..............x....x...x
    ...............B..............x....x...x
    ...............C..............x....x...x
    Order Mode.....Sales_Rep_ID > 10..11..12..
    Retail.........Order Status
    ...............A..............x....x...x
    ...............B..............x....x...x
    ...............C..............x....x...x
    Here "Order Mode" is the group field (it repeats for every group). Could you pl specify what output you are getting?
    If the problem is that you don't want the Title (like "Order Mode" in the above example) to print in every group, just place it outside the group repeating frame. It will print only once.
    Navneet.

Maybe you are looking for