Filtering a typed list

Posts   
 
    
rboarman
User
Posts: 83
Joined: 01-Feb-2005
# Posted on: 22-May-2007 04:30:38   

Hello,

I searched all over the forums for clues to this question but couldn’t find anything that applies directly.

I am using 2.0 adapter model.

What is the best way to fetch a typed list, and then filter it in a variety of ways without going back to the database each time?

Here’s what I am trying to do:


CommunitiesNavTypedList navMenu = new CommunitiesNavTypedList();
DataAccessAdapter adapter = new DataAccessAdapter();
IRelationPredicateBucket bucket = navMenu.GetRelationInfo();
bucket.PredicateExpression.Add(CommunitiesFields.DisplayLevel >= 0);
bucket.PredicateExpression.Add(CommunitiesFields.DisplayLevel < 2);

adapter.FetchTypedList(navMenu.GetFieldsInfo(), navMenu, bucket, 0, null, true);
.
.
.

bucket.PredicateExpression.Clear();  <== This call does not exist
bucket.PredicateExpression.Add(CommunitiesFields.DisplayLevel == 0);
bucket.ApplyPredicate();  <== This call does not exist          
foreach (CommunitiesNavRow communityRow in communities)
{
    Debug.Print(communityRow.Name);
}

How do I clear the current filter and then apply a new one without calling the database?

Thank you in advance.

Rick

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 22-May-2007 05:40:24   

TypedList's doesn't have a .FindMatches(IPredicateExpression) analogous to EntityCollection. However you can find rows via IDataTable.Select(string filter) method. http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=9939

David Elizondo | LLBLGen Support Team