How to set a Multiple condition in a single CFL
Hey guys, i have a problem filtering a CFL (ChooseFromList)
where i have to select records
WHERE U_SalesmanCode = <ConVal>
AND U_Status = <ConVal>
So i've come up with an idea setting up multiple conditions on a single CFL.
i have a function "SetCFLConditions" that will be called after the CHOOSEFROMLIST_EVENT was triggered. this will set the conditions on a loop method.
the CODE works fine. but it only accepts the last condition.
Public Sub SetCFLConditions(ByVal _chooseFromList As String, _
ByVal _alias As String, _
ByVal _operation As SAPbouiCOM.BoConditionOperation, _
ByVal _condVal As String)
Dim oCFLCollection As SAPbouiCOM.ChooseFromListCollection = _form.ChooseFromLists
Dim oCFL As SAPbouiCOM.ChooseFromList = oCFLCollection.Item(_chooseFromList)
Dim oCons As SAPbouiCOM.Conditions
Dim oCon As SAPbouiCOM.Condition
Dim asAlias() As String = _alias.ToString.Split(",")
Dim asCondVal() As String = _condVal.ToString.Split(",")
Dim i As Int16
'oCons = oCFL.GetConditions()
For i = 0 To asAlias.Length - 1
oCons = oCFL.GetConditions()
oCon = oCons.Add
.Alias = asAlias(i)
.Operation = _operation
.CondVal = asCondVal(i)
Dear Roger Arce,
Try to put oCFL.GetConditions() before the loop as:
...... oCons = oCFL.GetConditions() For i = 0 To asAlias.Length - 1 oCon = oCons.Add '//LOOP CONDITIONS With oCon .Alias = asAlias(i) .Operation = _operation .CondVal = asCondVal(i) End With Next i ......
SAP Business One Forums team