select * from t1 where (f1 + f2) > 1

Posts   
 
    
johnsmith
User
Posts: 19
Joined: 14-Dec-2004
# Posted on: 22-Oct-2009 17:57:08   

Does anyone know how to get LLBLGen (version 1.0.2005.1, self servicing) to replicate the query:

select * from t1 where (f1 + f2) > 1

or better still:

select * from t1 where (isnull(f1, 0) + isnull(f2, 0)) > 1

Thanks!

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Oct-2009 04:17:23   

Hi John,

johnsmith wrote:

select * from t1 where (f1 + f2) > 1

This should work (assuming you are using Adapter):

IRelationPredicateBucket bucket = new RelationPredicateBucket();                        
bucket.PredicateExpression.Add(
    new FieldCompareValuePredicate(new EntityField2("FieldSum", 
        new Expression(SalesOrderFields.Freight, ExOp.Add, SalesOrderFields.SubTotal)), 
    null, ComparisonOperator.GreaterThan, 1));

For more info, consult the manual (Using the generated code -> (Adapter | SelfServicing) -> Filtering and Sorting).

johnsmith wrote:

or better still:

select * from t1 where (isnull(f1, 0) + isnull(f2, 0)) > 1

Unfortunately DBFuncionCall was implemented in v2.0. You could try this workaround: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=7492&StartAtMessage=0&#50569

David Elizondo | LLBLGen Support Team