How do I filter a "Foreign View" TypedView?

Posts   
 
    
Paul
User
Posts: 28
Joined: 26-Feb-2004
# Posted on: 03-Dec-2004 23:24:13   

Let's say I have a TypedView (InvoicesTypedView) that selects rows from a table in a foreign database.

I would like to filter the view to a single record or set of records.

Since no entity class for this invoice table exists in the current database I don't have a PredicateFactory and I do not see how I can create the PredicateExpression.

Note: I am behind in versions (1.0.2003.1 March 8, 2004) Self-Servicing Model.

Any ideas?

View Example:

ALTER VIEW dbo.vf_Invoices AS SELECT OrderID, OrderDT, ... FROM Invoice.dbo.tb_Invoice

Code Example:

Dim invoices As New InvoicesTypedView() Dim invoicesFilter as IPredicateExpression = New PredicateExpression() invoicesFilter.Add( PredicateFactory.CompareValue(InvoicesFieldIndex.OrderID, _ ComparisonOperator.GreaterThan, 11000)) invoices.Fill(0, Nothing, True, invoicesFilter)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 04-Dec-2004 11:41:26   

But, the view contains all teh data, so you can filter on the view's values, or am I mistaken? (typed view columns also end up in the predicatefactory and have their own fieldindex)

Frans Bouma | Lead developer LLBLGen Pro
Paul
User
Posts: 28
Joined: 26-Feb-2004
# Posted on: 06-Dec-2004 16:16:14   

That's what I was missing. Previously I've used Entity FieldIndexes to filter a view instead of the TypedView's field index. That worked because the view was a subset of the table but contained all attributes.

Thanks for pointing out my mistake!