Skip to Content
0
Former Member
May 21, 2004 at 11:49 AM

2 Conditions in a Query

37 Views

Hi to all:

I Got an error when i execute: oDBDataSource1.Query oConditions

I can't instert two conditions??, with only one work's perfectly but when I insert a second group of condtions, I got a problem.

Here is the code:

Public Sub SetMatrix1(lproy As Integer)

Dim oConditions As SAPbouiCOM.Conditions

Dim oCondition As SAPbouiCOM.Condition

Dim i As Long

Dim oMatrix As SAPbouiCOM.Matrix

Set oConditions = New SAPbouiCOM.Conditions

Set oMatrix = oForm.Items.Item("Matrix1").Specific

Set oCondition = oConditions.Add

oCondition.BracketOpenNum = 1

oCondition.Alias = "U_usuario"

oCondition.Operation = co_EQUAL

oCondition.CondVal = lusuario

oCondition.BracketCloseNum = 1

oCondition.Relationship = cr_AND

oCondition.BracketOpenNum = 2

oCondition.Alias = "U_proyecto"

oCondition.Operation = co_EQUAL

oCondition.CondVal = lproy

oCondition.BracketCloseNum = 2

oDBDataSource.Query oConditions

oMatrix.Clear

Dim oBtn As SAPbouiCOM.Button

Dim oItem As SAPbouiCOM.Item

For i = 0 To oDBDataSource.Size - 1

oDBDataSource.Offset = i

' oUserDataSource1.Value = i + 1

oMatrix.AddRow

Next i

oMatrix.AutoResizeColumns

End Sub