Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> EntityCollection filter
 

Pages: 1
LLBLGen Pro Runtime Framework
EntityCollection filter
Page:1/1 

  Print all messages in this thread  
Poster Message
TomV
User



Location:
Belgium
Joined on:
31-Jan-2008 14:22:10
Posted:
76 posts
# Posted on: 29-Feb-2008 16:33:22.  
Hi,

The last hour I've been searching the forum for the answer to my problem.
I have an EntityCollection, fetched from the database, and I want to check if a certain value is available in the collection.

I used collection.FindMatches which return me a nice List<int>. So far so good.

The problem is that I want to check for corresponding lower case value. I'm not able to find a solution. I've been looking around and used EntityView2, etc...

Small example: Collection contains enties with a key field, values "Tom, Peter, Paul, ...".
The values I want to search for are: tom, peter, paul.
I don't find any matches... Sad


Anybody some idea so the FindMatches for tom returns the Tom entity?

Kind regards,
TomV
Life goes fast, it must be riding a Ducati!  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8099 posts
# Posted on: 29-Feb-2008 18:00:32.  
Maybe you are filtering this way...
Code:
// this test will fails
IPredicateExpression filter = new PredicateExpression();
filter.Add(CustomerFields.FisrtName == "tom");
List<int> matches = myCollection.FindMatches(filter);
Assert.IsTrue(matches.Count > 0, "...");


You should use FieldLikePredicate with CaseSensitiveCollation.
Code:
// this test will works ok
IPredicateExpression filter = new PredicateExpression();
FieldLikePredicate sensitiveFilter = new FieldLikePredicate(CustomerFields.FisrtName, null, "tom".ToUpper());
sensitiveFilter.CaseSensitiveCollation = true;
List<int> matches = coincidencias.FindMatches(filter);
Assert.IsTrue(matches.Count > 0, "...");


Let me know if you made it Wink


David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
TomV
User



Location:
Belgium
Joined on:
31-Jan-2008 14:22:10
Posted:
76 posts
# Posted on: 01-Mar-2008 13:52:13.  
Thanks daelmo,

When I used the following code, it worked.

FieldLikePredicate sensitiveFilter = new FieldLikePredicate(CustomerFields.FisrtName, null, "tom".ToUpper());
sensitiveFilter.CaseSensitiveCollation = true;
List<int> matches = coincidencias.FindMatches(sensitiveFilter);


Thanks a lot for your help!

Kind regards
TomV
Life goes fast, it must be riding a Ducati!  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.