Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Excluding current document from repeater View modes: 
User avatar
Member
Member
Greg - 1/26/2014 5:48:27 AM
   
Excluding current document from repeater
Hi,

On the selected news item template I've added on the right a box called "More news". I want to display there a list of links to other news which will not contain the current one (obviously as repeater).

Could you please help what will be the WHERE condition statement in repeater?

Greg



User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 1/26/2014 6:10:16 AM
   
RE:Excluding current document from repeater
Hi,

Thank you for your message.

This is an SQL question, you basically need to have same orderding as in the repeater which shows your news and skip the certain amount of rows from the repeater which shows the list of additional news. I found out this article where there is an example of how to use skip certain amount of rows. You need to be using SQL 2005+ for this (I believe you are).

Please refer to http://forums.asp.net/t/1591695.aspx

Kind regards,
Richard Sustek

User avatar
Member
Member
Greg - 1/27/2014 2:51:58 AM
   
RE:Excluding current document from repeater
Thank you,

Hmm I was thinking about some sort of solution like:

WHERE NewsID != selecteditem.NewsId

and was thinking there is some way to gain this selected item NewsId parameter. Especially on each page news this query will need to be different because how do I distinguish which news is selected / currently viewed?

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 1/28/2014 1:11:04 AM
   
RE:Excluding current document from repeater
Hi,

Thank you for your message.

Ah, I was thinking that you are displaying multiple news on a single page in a repeater or so. If you want to exclude only the current document it can be fairly easy. You can use macro to get the current document ID and then use it in a where condition like:


DocumentID != {% CurrentDocument.ID %}


Let me know how this works.

Kind regards,
Richard Sustek



User avatar
Member
Member
Greg - 1/28/2014 2:59:04 AM
   
RE:Excluding current document from repeater
Hehe I wanted to do it in transformation but for the selected item.
I thought there is a property which is "current NewsId" because we are within the selected transformation page and cms detects it. Sorry sounds like SF a bit ;)

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 1/28/2014 3:25:42 AM
   
RE:Excluding current document from repeater
Hi,

Thank you for your message.

Im a little bit lost here now.. You can indeed get the current NewsID inside a repeater in transformation. It would be like:

<%# Eval("NewsID") %>


Kind regards,
Richard Sustek