Casting EntityField2

Posts   
 
    
Posts: 72
Joined: 11-Aug-2006
# Posted on: 12-Sep-2006 03:15:21   

Hi There

I can't figure out what the issue is here. I am using Adapter. I am obviously overlooking something fundamental. The issue is with the field ActransactionFields.TransactionDate ( Which is an Entityfield2 I guess ) .

Your help is much appreciated. Marty

Argument '1': cannot convert from 'SD.LLBLGen.Pro.ORMSupportClasses.EntityField2' to 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityField'

EntityCollection<ActransactionEntity> transactions = new EntityCollection<ActransactionEntity>();

filter.PredicateExpression.Add(new FieldBetweenPredicate(ActransactionFields.TransactionDate ,import.DateFrom,import.DateTo)); adapter.FetchEntityCollection(transactions, filter);

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 12-Sep-2006 05:06:08   

Try using two compare predicates.

filter.PredicateExpression.Add(ActransactionFields.TransactionDate > import.DateFrom);
filter.PredicateExpression.AddWithAnd(ActransactionFields.TransactionDate < import.DateTo);
adapter.FetchEntityCollection(transactions, filter);
Posts: 72
Joined: 11-Aug-2006
# Posted on: 12-Sep-2006 05:40:09   

bclubb wrote:

Try using two compare predicates.

filter.PredicateExpression.Add(ActransactionFields.TransactionDate > import.DateFrom);
filter.PredicateExpression.AddWithAnd(ActransactionFields.TransactionDate < import.DateTo);
adapter.FetchEntityCollection(transactions, filter);

Nice one thanks. Seems odd that the between predicate doesn't work though- I implemented as per documentation.

Marty

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 12-Sep-2006 06:59:56   

FieldCompareBetweenPredicate works fine too.

The problem was that you used an overload specific to SelfServicing. The following should work:

filter.PredicateExpression.Add(new FieldBetweenPredicate(ActransactionFields.TransactionDate, null, import.DateFrom, import.DateTo));
adapter.FetchEntityCollection(transactions, filter);

Just take care of the extra null parameter.

Posts: 72
Joined: 11-Aug-2006
# Posted on: 13-Sep-2006 02:28:34   

Walaa wrote:

FieldCompareBetweenPredicate works fine too.

The problem was that you used an overload specific to SelfServicing. The following should work:

filter.PredicateExpression.Add(new FieldBetweenPredicate(ActransactionFields.TransactionDate, null, import.DateFrom, import.DateTo));
adapter.FetchEntityCollection(transactions, filter);

Just take care of the extra null parameter.

Nice one
sunglasses Thx

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 13-Sep-2006 03:56:16   

much better simple_smile