Question about FieldLikePredicate

Posts   
 
    
w3stfa11
User
Posts: 13
Joined: 01-Jul-2010
# Posted on: 15-Sep-2010 22:30:32   

Edit: Oops, I meant to post this in the General Forum, not Generated Code forum.

I have a two fields in a database, FirstName and LastName.

Temporarily, I've got something like this for the AccountCollection: filter.Add(AccountFields.FirstName % searchTerm); // searchterm = "joe smi%" filter.Add(AccountFields.LastName % searchTerm);

However, I'd like to be able to search their 'fullname' which doesn't exist as a database field. For example, for person Joe Smith, searching 'Joe' finds it, but not when I search 'Joe Sm' (or even 'Joe Smith'. What's an easy way to do this (or point me in the right direction)?


One other question.

I'd like to be able to finetune the filtering a bit more. How can I do something like this: filter (A == a) AND (B == b OR C == c OR D == d)

Thank you,

llblgen 2.6 self-servicing Sql Server 2008

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Sep-2010 07:21:45   

w3stfa11 wrote:

Temporarily, I've got something like this for the AccountCollection: filter.Add(AccountFields.FirstName % searchTerm); // searchterm = "joe smi%" filter.Add(AccountFields.LastName % searchTerm);

However, I'd like to be able to search their 'fullname' which doesn't exist as a database field. For example, for person Joe Smith, searching 'Joe' finds it, but not when I search 'Joe Sm' (or even 'Joe Smith'. What's an easy way to do this (or point me in the right direction)?

Here you go: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=5436

w3stfa11 wrote:

I'd like to be able to finetune the filtering a bit more. How can I do something like this: filter (A == a) AND (B == b OR C == c OR D == d)

PredicateExpression subFilter1 = new PredicateExpression();

subFilter1.Add(B ==b);
subFilter1.AddWithOr(C == c);
subFilter1.AddWithOr(D == d);

filter.Add(A == a);
filter.Add(subFilter);

Or simply:

filter.Add(A == a & (B == b | C == c | D == d));

Here is all you need to know about Filtering.

David Elizondo | LLBLGen Support Team