Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Basic Repeater with 'Where' condition View modes: 
User avatar
Member
Member
anthony.halliday - 3/26/2013 11:22:03 AM
   
Basic Repeater with 'Where' condition
Hi.

Is there a control that by default can filter a data source.

I dont mean the sort of filter a user can use to filter products, there are a number of uses i would have liked to use something like this, for example on a page you may have 2 or even 3 navigation bars with different levels of content e.g. the top of the page may have 3 or 4 levels then there may be a left hand nav with 2 levels from the current page then the root in the footer.

Rather than having three separate repeaters hitting the database 3 times could i not have a data source that gets all the content then each basic repeater that creates the navigation (or whatever content) filters the data independently with a 'Where' condition.

I have every intention of creating a control for this, i just wondered if i had missed a default web part that could do this.

Thanks, Anthony.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 3/26/2013 1:38:11 PM
   
RE:Basic Repeater with 'Where' condition
A Basic Repeater can use a filter either one you create or the built-in Document filter. I give an example here on how to create one, which might be a bit overkill for what you're looking for but none the less, it works.

The other option you have is to go to the documen type or custom table and create a query and use the Custom Query Repeater webpart. This will allow you to define a query on your own in the Site Manager and specify a where clause.

User avatar
Member
Member
anthony.halliday - 3/27/2013 3:41:50 AM
   
RE:Basic Repeater with 'Where' condition
Thanks for the link, i will have a look into the filters a bit more.

My only concern (it may however be that is have the wrong understanding of filters) is that a filter filters data from the entire data source. What i would like to do is have one data source that holds data from either a custom table or doc type then have any number of filters that act as data sources themselves, but rather than getting the same data from the database x number of times i could just get it once (in the main data source) and filter it into 'filtered data sources' then specify the 'filtered data source' as at the source of a basic repeater.

Thanks,

Anthony.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 3/27/2013 3:13:52 PM
   
RE:Basic Repeater with 'Where' condition
You're right a filter essentially specifies the WhereClause, TopN, Columns, etc and passes it to the datasource and the datasource gets the data as specified from the filter. You can cache the data if you'd like. I'd suggest creating your own custom datasource webpart to do this work.

If you're concerned about performance, I don't believe you have much to worry about. I've created several of these filters which call external webservices to get/set parameters and the pages function just as fast as other pages.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 3/27/2013 3:16:06 PM
   
RE:Basic Repeater with 'Where' condition
anthony.halliday wrote: What i would like to do is have one data source that holds data from either a custom table or doc type then have any number of filters that act as data sources themselves
In regards to this, I'm not sure this will work as easy or well as you might expect it to unless you are creating and mapping columns and alias names which seems like more work that what its worth. Especially since you'd have to go to the class defintion of the document type or custom table.

User avatar
Member
Member
anthony.halliday - 3/28/2013 3:52:44 AM
   
RE:Basic Repeater with 'Where' condition
Thanks a lot for your advice.

Anthony.