filter a TypedView in-memory

Posts   
 
    
mkamoski avatar
mkamoski
User
Posts: 116
Joined: 06-Dec-2005
# Posted on: 05-Sep-2006 16:43:56   

All --

Please help.

Is it possible to filter a TypedView in-memory?

I want to do something like this pseudo-code...


myPredExpression = 'build PredicateExpression

myFilterBucket = 'build RelationPredicateBucket with myPredExpression 

Dim myITypedView As ORMSupportClasses.ITypedView2 = EntityAdapter.HelperFactory.GetTypedView(GetType(BusinessObjects.TypedViewClasses.SomeTypedView), myFilterBucket, allowDuplicates:=False)

'...blah, blah, blah...

myTypedView1 = DirectCast(myITypedView, BusinessObjects.TypedViewClasses.SomeTypedView)

'now I have ALL my data, hitting the database only 1x...

myTypedView2 = some portion of myTypedView1 fitered (where SomeKey=2)

myTypedView3 = some portion of myTypedView1 fitered (where SomeKey=3)

'...blah, blah, blah...

...and so on.

Bascially, I want to get all of my data from the database in one read and then filter out subsets of that data based on some key.

Is this possible?

If yes, then can you give a brief description of how to do it?

Please advise.

Thank you.

-- Mark Kamoski

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 05-Sep-2006 19:50:31   

Hi,

a TypedView inherits from DataTable, so it has the same in memory capabilities.

You should be able to use yourDT.Select() a bit the same way that you'd use FindMatches() from a Collection, instead that it takes a string there.

Have a look at the datatable doc.

Also, it returns a DataRow array so you'll have to add them in your new Views.

Hope that helps

mkamoski avatar
mkamoski
User
Posts: 116
Joined: 06-Dec-2005
# Posted on: 07-Sep-2006 21:56:28   

Jessynoo wrote:

Hi,

a TypedView inherits from DataTable, so it has the same in memory capabilities.

You should be able to use yourDT.Select() a bit the same way that you'd use FindMatches() from a Collection, instead that it takes a string there.

Have a look at the datatable doc.

Also, it returns a DataRow array so you'll have to add them in your new Views.

Hope that helps

Yes, that helps a lot.

(I simply forgot that the TypedView IS a DataTable.)

Thank you.

-- Mark Kamoski