📚 SAP Business One SDK Help

Add Method
See Also  Example

Description

Adds a condition to the collection.

Syntax

Visual Basic
Public Function Add() As Condition

Example

The following sample code shows how to add conditions to query the database.
(Visual Basic)Copy Code
Public Sub AddingConditions()

    Dim oConditions As SAPbouiCOM.Conditions
    Dim oCondition As SAPbouiCOM.Condition

    '// create a new conditions collection
    Set oConditions = New SAPbouiCOM.Conditions

    '// the requested conditions
    '// 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

End Sub

See Also