Problems with predicates

Posts   
 
    
Geert
User
Posts: 10
Joined: 22-Apr-2005
# Posted on: 15-Jun-2005 14:55:38   

Hi,

I am new to this product so bare with me. I want to create a new predicate with the function "FieldCompareValuePredicate"

The first parameter is a field of type ientityfield

but the types of my fields I am seeing in my entity are of type IentityField2 because I am using the adapter scenario.

I do something like this

bucket.PredicateExpression.Add((New FieldCompareValuePredicate(FactoryClasses.EntityFieldFactory.Create(PublicationFieldIndex.UseOnline), ComparisonOperator.Equal, CType(strValue, System.Boolean))))

The create function of the entityfieldfactory class returns me a field of type IentityField2

Can't I use the the FieldCompareValuePredicate in a adapter scenario.

Please could you explain what I am doin wrong. frowning

Thanks

Geert

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 15-Jun-2005 15:08:22   

Either use the predicate factory for convenience:


bucket.PredicateExpression.Add(PredicateFactory.CompareValue(PublicationFieldIndex.UseOnline, ComparisonOperator.Equal, CType(strValue, System.Boolean)))

or use the adapter constructor overload:


FieldCompareValuePredicate(FactoryClasses.EntityFieldFactory.Create(PublicationFieldIndex.UseOnline), Nothing,  ComparisonOperator.Equal, CType(strValue, System.Boolean))))

Frans Bouma | Lead developer LLBLGen Pro
wvnoort
User
Posts: 96
Joined: 06-Jan-2005
# Posted on: 15-Jun-2005 15:08:23   

There are more overloads. Use one the overloads that require a PersistenceInfoBucket as the second parameter. Supply one, or pass null as in:

 predicateToAdd = 
                        new FieldCompareValuePredicate(field, null, ComparisonOperator.Equal, valueToUse);
Geert
User
Posts: 10
Joined: 22-Apr-2005
# Posted on: 15-Jun-2005 15:28:15   

Thanks for the quick response

Problem solved

Geert