A couple of simple questions

Posts   
 
    
slade52
User
Posts: 46
Joined: 15-Aug-2007
# Posted on: 11-Jul-2008 01:21:48   

Hi, Need help with a couple of small things please...

  1. trying to implement this WHERE clause:
WHERE (DebtorBalance.Overdue3Months + DebtorBalance.Overdue4Months) >= 10000

tried this but it doesn't work (kinda obviously):

filter.Add(new FieldCompareExpressionPredicate((DebtorBalanceFields.Overdue3Months + DebtorBalanceFields.Overdue4Months),  ComparisonOperator.GreaterEqual, 10000));

  1. Also, how do you do ISNULL in a TypedList field definition ? e.g.
SELECT ISNULL(DebtorBalance.TotalDebt, 0) AS TotalDebt,

v2.6, SelfServicing

Thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 11-Jul-2008 06:32:34   

slade52 wrote:

Hi, Need help with a couple of small things please...

  1. trying to implement this WHERE clause:
WHERE (DebtorBalance.Overdue3Months + DebtorBalance.Overdue4Months) >= 10000

tried this but it doesn't work (kinda obviously):

filter.Add(new FieldCompareExpressionPredicate((DebtorBalanceFields.Overdue3Months + DebtorBalanceFields.Overdue4Months),  ComparisonOperator.GreaterEqual, 10000));

Try this:

filter.Add(DebtorBalanceFields.Overduu3Months.SetExpression(  
     DebtorBalanceFields.Overdue3Months + DebtorBalanceFields.Overdue4Months) 
     >= 10000));

slade52 wrote:

  1. Also, how do you do ISNULL in a TypedList field definition ? e.g.
SELECT ISNULL(DebtorBalance.TotalDebt, 0) AS TotalDebt,

You have to use DBFunctionCall:

fields[0].ExpressionToApply =  new DbFunctionCall( "ISNULL({0},0)", new object[] { DebtorBalance.TotalDebt } );
David Elizondo | LLBLGen Support Team
slade52
User
Posts: 46
Joined: 15-Aug-2007
# Posted on: 11-Jul-2008 07:55:11   

Thanks Daelmo

slade52
User
Posts: 46
Joined: 15-Aug-2007
# Posted on: 14-Jul-2008 01:32:00   

daelmo wrote:

Try this:

filter.Add(DebtorBalanceFields.Overduu3Months.SetExpression(  
     DebtorBalanceFields.Overdue3Months + DebtorBalanceFields.Overdue4Months) 
     >= 10000));

Hi Daelmo. I coudn't make that work, but in the end I added a calculated field to the fields collection:

fields.DefineField(new EntityField("Calculated", (DebtorBalanceFields.Overdue3Months + DebtorBalanceFields.Overdue4Months)), 11);

... and added a predicate to test it ...

filter.Add(new FieldCompareValuePredicate(fields[11], ComparisonOperator.GreaterEqual, 10000));

That works fine, with the obvious side effect of an extra field in the result set, but I can work around that.

Thanks again.