Skip to Content
0
Former Member
Jun 10, 2016 at 10:14 AM

CFL Not showing Data

91 Views

DEAR ALL,

I am trying to display Emp Name from OHEM . I am using below code in my project , But CFL is not display data. Code execute successfully , but it does not display ,

I am also replace Alias name to EMPName , but it does not show data.

Private Function BeforeCFL()

Dim rsetCFL As SAPbobsCOM.Recordset = Nothing

Try

Dim strQuery As String = String.Empty

strQuery = "SELECT DISTINCT T0.[firstName] + ' ' + T0.[lastName] as 'EmpName' FROM OHEM T0 WHERE T0.[position] Is not null and ACTIVE='Y' "

Dim ocfl As SAPbouiCOM.ChooseFromList

Dim oCFL_collection As SAPbouiCOM.ChooseFromListCollection

Dim ocondition As SAPbouiCOM.Condition = Nothing

Dim oconditions As SAPbouiCOM.Conditions = Nothing

Dim oEmptyConds As New SAPbouiCOM.Conditions

oCFL_collection = oForm.ChooseFromLists

ocfl = SBO_Application.Forms.ActiveForm.ChooseFromLists.Item("CFLOwner")

rsetCFL = oApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

ocfl.SetConditions(oconditions)

oconditions = ocfl.GetConditions

rsetCFL.DoQuery(strQuery)

rsetCFL.MoveFirst()

For i As Integer = 1 To rsetCFL.RecordCount

If i = (rsetCFL.RecordCount) Then

ocondition = oconditions.Add()

ocondition.Alias = "lastName"

ocondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL

ocondition.CondVal = rsetCFL.Fields.Item(0).Value

Else

ocondition = oconditions.Add()

ocondition.Alias = "lastName"

ocondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL

ocondition.CondVal = rsetCFL.Fields.Item(0).Value

ocondition.Relationship = SAPbouiCOM.BoConditionRelationship.cr_OR

End If

rsetCFL.MoveNext()

Next

If rsetCFL.RecordCount = 0 Then

ocondition = oconditions.Add()

ocondition.Alias = "lastName"

ocondition.Relationship = SAPbouiCOM.BoConditionRelationship.cr_NONE

ocondition.CondVal = "-1"

End If

ocfl.SetConditions(oconditions)

Catch ex As Exception

Finally

System.Runtime.InteropServices.Marshal.ReleaseComObject(rsetCFL)

End Try

Return True

End Function

How to solve this issue?