Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to set a Multiple condition in a single CFL

Hi everyone,

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

oCFL.SetConditions(Nothing)

'oCons = oCFL.GetConditions()

For i = 0 To asAlias.Length - 1

oCons = oCFL.GetConditions()

oCon = oCons.Add

'//LOOP CONDITIONS

With oCon

.Alias = asAlias(i)

.Operation = _operation

.CondVal = asCondVal(i)

End With

Next i

oCFL.SetConditions(oCons)

End Sub

Pls. Help

Thanks

Roger

Former Member
Former Member replied

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
......

Best Regards

Jane Jing

SAP Business One Forums team

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question