3 Replies Latest reply: Oct 15, 2009 4:58 PM by Marc Roussel RSS

Screen Painter.  How to...

Marc Roussel
Currently Being Moderated

How to use the Matrix with a complex query and beeing able to make some columns with a LinkButton to the document.

Which control should I use.  A Matrix, or a Grid


Which one let me get Data from a complex query and by the same time beeing able to set some columns as Link to a document


To date I've been able to use the DBDataSource.Add("BUT IT NEEDS A TABLE") not a query and I face the challenge

of adding all the conditions with the dbDataSource.Query(CONDITIONS) which doesn't work since I have to get

data from other tables....

  • Re: Screen Painter.  How to...
    Boukhris Abderrahim
    Currently Being Moderated

    Hello ,


    Bellow a simple of what you need


    Dim oMatrix as Matrix
    oMatrix =  CType(oForm.Items.Item("MtxId").Specific, Matrix)
    Private MyTable As DataTable
    MyTable = Me.oSboForm.DataSources.DataTables.Item("MyDataTable")
    Dim Query As String = "SELECT DISTINCT T0.[ItemCode],T0.[ItemName] FROM OITM"
    MyTable.ExecuteQuery(Query )
    Dim oColumn As SAPbouiCOM.Column
    oColumn = oMatrix .Columns.Item("V_0")
    Dim oLinkedButton As SAPbouiCOM.LinkedButton
    oLinkedButton = CType(oColumn .ExtendedObject, LinkedButton)
    oLinkedButton .LinkedObject = SAPbouiCOM.BoLinkedObject.lf_Items
     oMatrix.Columns.Item("V_0").DataBind.Bind("MyDataTable", "ItemCode")
     oMatrix.Columns.Item("V_1").DataBind.Bind("MyDataTable", "ItemName")


    hope it helps .





    Edited by: Boukhris Abderrahim on Oct 15, 2009 1:09 PM

    • Re: Screen Painter.  How to...
      Marc Roussel
      Currently Being Moderated

      Awesome.  Thank you. 


      Just a last question.  When I set the Query in the Screen Painter. Why do I have to provide it again by code ?


      I did create the Data Table in Screen Painter and called it dtORDR but in code

      but I have to do a ExecuteQuery and provide the query again ?


      Since I get it the way you explained, why do I have to ExecuteQuery with the same query again ?


      I also get a Table not found when running


      MyDataTable is called dtORDR made in the ScreenPainter with a simple SELECT

      and by code I do like you said, and the binding are on dtORDR but I get "Table not found..."

      Here's my actual code :


      string Query = "SELECT ORDR.DocEntry AS OrderEntry, ORDR.DocNum AS OrderNum, ORDR.NumAtCard, ORDR.DocDueDate, ORDR.DocTotal, " +
                     "ORDR.CardCode AS CustomerCode, ORDR.CardName AS CustomerName, OCRD.FatherCard, OCRD.CreditLine " +
                     "FROM ORDR INNER JOIN " +
                     "OCRD ON ORDR.CardCode = OCRD.CardCode";
      oApprobationsMatrix = oForm.Items.Item("mOrders").Specific as SAPbouiCOM.Matrix;
      SAPbouiCOM.DataTable DBDataTable = oForm.DataSources.DataTables.Item("dtORDR");
      // Settings the columns...
      oApprobationsMatrix.Columns.Item("Indicator").Width = 20;
      oApprobationsMatrix.Columns.Item("cDocNum").DataBind.SetBound(true, "dtORDR", "OrderNum");
      oApprobationsMatrix.Columns.Item("cDocNum").Editable = false;
      oApprobationsMatrix.Columns.Item("cDocNum").Width = 107;
      oApprobationsMatrix.Columns.Item("cDocEntry").DataBind.SetBound(true, "dtORDR", "OrderEntry");
      oApprobationsMatrix.Columns.Item("cDocEntry").Visible = false;


      I also tried to remove the table from the Screen Painter and use the code instead like this


      oApprobationsMatrix = oForm.Items.Item("mOrders").Specific as SAPbouiCOM.Matrix;
      SAPbouiCOM.DataTable DBDataTable = oForm.DataSources.DataTables.Add("dtORDR");


      and I stiil get "Table Not Found"

      but the table seems to be there all right. 


      [See this image...|http://pages.videotron.com/gear/problem.jpg]