Filtering TypedView using a predicate expression

Posts   
 
    
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 02-Jun-2010 21:30:29   

Hi is it possible to filter a typedview using a predicate expression?

i have the list of all active students as a typedview and would like to filter the new enrolled students only.

i know i can create the predicate and call the fill method on typedview but the typedview is a cached object. the filter method uses the typedview and the filter as its parameters. it is something like:

FilterUsingStatus(ActiveStudentsTypedView toFilter, string status) { ... }

thanks in advance -shane

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Jun-2010 04:04:18   

What do you mean by "Cached object"? The typedView is already filled and you want to filter it in memory?

David Elizondo | LLBLGen Support Team
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 03-Jun-2010 06:19:56   

daelmo wrote:

What do you mean by "Cached object"? The typedView is already filled and you want to filter it in memory?

that is right. but i would like to use a predicate expression (if possible) to do the filtering. this active students typed view does not change much and used often so i decided to fill it and keep in cache and filter it in memory. if in memory filtering it is not possible through predicate expression i think i ll just fill it whenever it is requested.

thanks -shane

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 03-Jun-2010 08:23:08   

Not possible using predicateExpression.

but why do you insist on using a predicateExpression?

You can filter it using Linq, as shown here: http://social.msdn.microsoft.com/Forums/en/linqprojectgeneral/thread/cc3b0486-1031-4113-afb6-29dfa6e0319b

http://msdn.microsoft.com/en-us/library/bb669073.aspx

Hint: a TypedView is a DataTable.