How to construct the filter

Posts   
 
    
jmcjq2
User
Posts: 26
Joined: 17-Nov-2009
# Posted on: 20-Nov-2009 05:48:56   

How do you constuct the filter for this:

WHERE Left([Table.Column,1))="1"))

Thanks in advance John

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 20-Nov-2009 06:36:53   

Two ways (assuming Adapter templateset, but it's similar with SelfServicing):

A. The LEFT function using DBFuncionCall:

EntityField2 leftPart = new EntityField2("LeftExp",
     new DBFunctionCall("LEFT", new object[] { MyEntityFields.SomeColumn, 1}) );

// here filter is a relationPredicateBucket
filter.PredicateExpression.Add(leftPart == "1");

B. Like predicate should work for the example you posted:

// here filter is a relationPredicateBucket
filter.Add(MyEntityFields.SomeColumn % "1%");
David Elizondo | LLBLGen Support Team
jmcjq2
User
Posts: 26
Joined: 17-Nov-2009
# Posted on: 20-Nov-2009 07:31:50   

Thanks simple_smile

Not sure why i didn't thought of Option B flushed