cancel
Showing results for 
Search instead for 
Did you mean: 

Condition equivalent for where field in collection?

Former Member
0 Kudos

Hi there,

i have to translate the following sql-condition to a bone-condition:


select * from (OCRD) where 'Value' in ('Value', 'Value1', 'Value2')

Is that possible? If yes... how?

Kind Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Thomas,

Please explain what do you mean by "Bone-Condition"?

Regards,

Vítor Vieira

Former Member
0 Kudos

Hi Vitor,

i mean the Condition Object from the UI API.

from SDK-Help:


    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

Regards

Thomas Mandlmeier

Former Member
0 Kudos

Hi Thomas,

Yes, it possible.

Here's a sample


Dim oRS As SAPbobsCOM.Recordset = oCompany.GetBusinessObject(BoRecordSet)
oRS.DoQuery("SELECT ItemCode FROM OITM")

If oRS.RecordCount > 0 Then
     oConds = New SAPbouiCOM.Conditions
     While Not oRS.EoF
          oCond = oConds.Add
          oCond.Alias = "Code"
          oCond.Operation = BoConditionOperation.co_EQUAL
          oCond.CondVal = oRS.Fields.Item(0).Value.ToString.Trim

          oRS.MoveNext()
          If Not oRS.EoF Then oCond.Relationship = BoConditionRelationship.cr_OR
     End While
End If

Regards,

Vítor Vieira

Former Member
0 Kudos

Hi Vitor,

thank you for your answer. I got the same idea.

I was hoping for an answer like.


    oCondition.Operation = co_EQUAL
    oCondition.CondVal = "('Val1', 'Val2', 'Val3')"

Or something like that

Maybe i should really try this in a loop as in your example.

Regards

Thomas Mandlmeier

Former Member
0 Kudos

Hi Thomas,

I would also like for that sintax to work, but it doesn't.

Please give a try to the loop approach.

Kind Regards,

Vítor Vieira