Skip to Content
author's profile photo
Former Member

Adding condition when using DBDataSource

hi

i want to add our custom form controls directly to the database table using DBDataSource, It fetches all the data that exist in the particular table. <b>But if i want some filter condition on the data, how we can add it????</b>

If any sample then plz send...

Thx.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    author's profile photo
    Former Member
    Oct 06, 2005 at 10:58 AM

    You can find this very good example in the UI API reference/help file :

    Set oConditions = New SAPbouiCOM.Conditions

    '// Let's assume we wish our query to select

    '// Bussines Partners of type "C" (Customers)

    '// or "S" (Suppliers)

    '// WHERE ((CardType = 'C') Or (CardType = 'S'))

    '// the conditions collection encapsulates the WHERE clause

    '// of a select statement

    Set oCondition = oConditions.Add

    '// ((CardType = 'C') Or

    oCondition.BracketOpenNum = 2

    oCondition.Alias = "CardType"

    oCondition.Operation = co_EQUAL

    oCondition.CondVal = "C"

    oCondition.BracketCloseNum = 1

    oCondition.Relationship = cr_OR

    Set oCondition = oConditions.Add

    '// (CardType = 'S'))

    oCondition.BracketOpenNum = 1

    oCondition.Alias = "CardType"

    oCondition.Operation = co_EQUAL

    oCondition.CondVal = "S"

    oCondition.BracketCloseNum = 2

    '// Execute the query with the conditions collection

    oDBDataSource.Query oConditions

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      DBDataSource object is very limited.

      In the conditions you only can set the 'WHERE' statement. Maybe the is a 'trick' but i don't think that it is possible to make a join in DBDataSources.

      The Problem is that you can have more than one Datasource in a form but you can only link one to a matrix.

      DBDataSource was made for browsing only.

  • Oct 06, 2005 at 01:31 PM

    Hi Pankaj!

    I had the same issue in the beginning of the year. You can learn more about my issue and find a solution at JIONs-Query as MatrixDataSourse

    Add comment
    10|10000 characters needed characters exceeded