Skip to Content
author's profile photo Former Member
Former Member

Adding data to a matrix with dbdatasources in sbo 2004

Hi

I have a matrix with dbdatasources. When I load existing data everything is fine but when I want to create a new matrix it seems to behave in an unusual way, when I click on a cell it beeps at me !

I run a query to pick up the default gl codes which I want to add to the datasource.

I have included the code below, am I doing something silly ?

Regards Andy

    ' read admin codes
    Set orecset = oCompany2.GetBusinessObject(BoRecordset)
    orecset.DoQuery ("select acctname,acctcode from oact where fathernum = '200000000000000' and finanse = 'N' and locmantran = 'N'")
    If orecset.RecordCount > 0 Then
      While Not orecset.EOF
        If orecset(1).Value <> "x" Then
            oform.DataSources.DBDataSources(0).InsertRecord lc
            oform.DataSources.DBDataSources(0).SetValue "u_contrno", lc, Left(orecset(1).Value, 10)
            oform.DataSources.DBDataSources(0).SetValue "u_contrde", lc, Left(orecset(0).Value, 10)
            oform.DataSources.DBDataSources(0).SetValue "u_gltype", lc, "1"
        End If
        orecset.MoveNext
        lc = lc + 1
      Wend

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Oct 11, 2005 at 02:34 PM

    Hi Paul,

    Why don't you fill the DBDataSources automatically?

    You have the method LoadFromDataSource() on the matrix object since 2004 version.

    Here you have a sample:

    ' Add Conditions to the query to filter the datas to show

    conds = New SAPbouiCOM.Conditions

    cond = conds.Add()

    ' WHERE (CardCode = 'C20000')

    cond.BracketOpenNum = 1

    cond.Alias = "CardCode"

    cond.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL

    cond.CondVal = "C20000"

    cond.BracketCloseNum = 1

    'Fill the Datasources with the result of the query with the conditions specified

    dbDataSource.Query(conds)

    'Fill matrix with data sources automatically

    matrix.LoadFromDataSource()

    Hope it helps

    Trinidad.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.