Nested Filter

Posts   
 
    
johnfattal
User
Posts: 6
Joined: 14-Feb-2007
# Posted on: 19-Mar-2007 15:52:39   

LlblGen 2.0.0.0 Adapter

Does LLblGen provide support for nested filters?

The example I have is as follows: I have an Accounts table which contains an AccountId and a ParentAccountId. Based on a particular search value i.e. accountId between 2 and 5, I would like to pull back those matching records, and then all child records for those accounts.

Nesting can go more than 2 levels deep.

Is there support for anything like this in LlgblGen, or will I need to write a custom Sproc?

Thanks!

Aurelien avatar
Aurelien
Support Team
Posts: 162
Joined: 28-Jun-2006
# Posted on: 19-Mar-2007 16:14:10   

Hi,

Unfortunatly, i don't see an easy way to do that. By the way you can write a SP or create a view.

Cheers,

Aurélien

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 20-Mar-2007 12:08:02   

I think it could be done with a subquery, but only for that second level deep. This is a problem with SQL and stored trees in a single table: it's not possible to fetch a hierarchy with a single select. There are a couple of different ways to store trees in a relational database which do offer 1 query per hierarchy possibilities, but have other issues (like slow inserts).

With a proc you need a cursor and recursive proc calls, also not that nice. See for examples this thread: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3208

Frans Bouma | Lead developer LLBLGen Pro