Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Orderby View modes: 
User avatar
Member
Member
lwhittemore-emh - 3/28/2012 8:20:10 AM
   
Orderby
I am trying to create a repeater that pulls the top 6 images from all the galleries based off of where they are in the tree. ( i will diagram the treeview below) I tried orderby="NodeOrder", but that pulls all the "image 1"s. I also tried orderby="NodeLevel, NodeOrder" but that did the same. I then tried orderby="NodeLevel, NodeOrder, NodeName" and that resulted in a different list than the other two but did not get me the 6 I wanted (noted with * in the treeview below).

Any thoughts?

tree looks like this
Page (Where I want the repeater on)
gallery 1
image 1*
image 2*
Gallery 2
image 1*
image 2*
image 3*
Gallery 3
image 1*
image 2
image 3
Gallery 4
image 1.....


User avatar
Member
Member
kentico_alleng - 3/28/2012 1:28:19 PM
   
RE:Orderby
The problem with ordering by NodeLevel, NodeOrder, NodeName is that the parent folders will all have the same level, as will the images.

In other words, if Page is directly under root, it's NodeLevel is 1. The gallery folders are all NodeLevel 2, and the images are all NodeLevel 3. So for the top 6, you'll get something like:

image 1, image 1, image 1, image 2, image 2, image 2

One quick fix is to change your OrderBy to: NodeParentId DESC,NodeLevel, NodeOrder,NodeName. Of course, that only works if the parent nodes were created in order.

A method that is more generic and would continue to work even if the parent folders were re-ordered would be much more complex. Options would most likely involve creating a custom repeater or custom datasource web part.

If you weren't limiting to the top 6 documents, you could make use of a nested repeater. It's the combination of listing sub-documents in the order they appear and limiting the results that leads to this requiring a custom solution.

Please let us know if you have any further questions.

Regards,

Allen Greenhaw