on 04-17-2009 12:15 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This is how i add the conditions..
Dim oCFLS As SAPbouiCOM.ChooseFromListCollection
Dim oCons As SAPbouiCOM.Conditions
Dim oCon As SAPbouiCOM.Condition
Dim oCFL As SAPbouiCOM.ChooseFromList
Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
oCFLS = objForm.ChooseFromLists
oCFLCreationParams = objSBOAPI.CreateUIObjectSAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
oCFLCreationParams.MultiSelection = False
oCFLCreationParams.ObjectType = "2"
oCFLCreationParams.UniqueID = "CFL1"
oCFL = oCFLS.Add(oCFLCreationParams)
oCFLCreationParams.ObjectType = "2"
oCFLCreationParams.UniqueID = "CFL2"
oCFL = oCFLS.Add(oCFLCreationParams)
oCons = objForm.ChooseFromLists.Item("CFL1").GetConditions
oCon = oCons.Add()
oCon.Alias = "CardType"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = "C"
objForm.ChooseFromLists.Item("CFL1").SetConditions(oCons)
objForm.ChooseFromLists.Item("CFL2").SetConditions(oCons)
Hope it helps,
Vasu Natari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sir vasu natari
Thank for your reply, yes the code above does that, but the problem is the CFL only recognizes the last condition. just like the sample code below:
"I need to filter the CFL using 2 condition"
oCFLCreationParams.ObjectType = "2"
oCFLCreationParams.UniqueID = "CFL1"
oCFL = oCFLS.Add(oCFLCreationParams)
oCons = objForm.ChooseFromLists.Item("CFL1").GetConditions
oCon = oCons.Add()
oCon.Alias = "CardCode"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = "2"
oCon = oCons.Add()
oCon.Alias = "CardType"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = "C"
objForm.ChooseFromLists.Item("CFL1").SetConditions(oCons)
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.