Predicate Expression Issue moving from v2.6 to 4.2

Posts   
 
    
MikeFerox
User
Posts: 14
Joined: 15-Dec-2015
# Posted on: 15-Dec-2015 06:26:54   

Hi Everyone, hopefully someone can help me with the issue i'm having.

I have recently taken on a client who uses this software, and it was all working fine, however I now need to make changes.

As their database has been upgraded since the project was originally completed, version 2.6 will no longer connect.

I have updated to version 4.2 and now I am having lots of errors occur within the code, mostly focused around the predicate expressions.

The original code is as follows: Dim TaskTypesFilter As SD.LLBLGen.Pro.ORMSupportClasses.IPredicateExpression = New SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression(MunerisClass.FactoryClasses.PredicateFactory.CompareValue(MTaskTypeFieldIndex.TaskTypeActive, SD.LLBLGen.Pro.ORMSupportClasses.ComparisonOperator.Equal, True))

Which is simply creating a filter for TaskTypeActive equaling True. I believe that the new code should look like this: Dim EmployeeFilter As SD.LLBLGen.Pro.ORMSupportClasses.IPredicateExpression = (MEmployeeFields.EmployeeActive = "True")

However the class MEmployeeFields does not exist anywhere in the generated code, only MEmployeeFieldIndex.

Having looked into this, I believe i do require the use of MEmployeeFields however I cannot figure out how to utilise it.

I am running LLBLGen Pro build 4.2 Final with the build preset SelfServicing.General

If anyone has any idea how to solve this issue that would be amazing, I imagine it has something to do with my build settings...

Thanks in advance.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 15-Dec-2015 06:53:04   

Hi Mike,

To use the MEmployeeFields you have to import the namespace

<ProjectRootNamespace>.HelperClasses

... where <ProjectRootNamespace> is the root namespace of your project.

Also, use True instead of "True" (which is a string not bool):

Dim EmployeeFilter As SD.LLBLGen.Pro.ORMSupportClasses.IPredicateExpression = (MEmployeeFields.EmployeeActive = True)

For more info, see Filtering and Sorting.

David Elizondo | LLBLGen Support Team
MikeFerox
User
Posts: 14
Joined: 15-Dec-2015
# Posted on: 15-Dec-2015 07:35:35   

Hi Daelmo,

This worked, thanks so much.

I new there was something simple I was missing.