Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Filter Query Repeater with Document Value View modes: 
User avatar
Member
Member
paul.truman-sunmed.co - 9/3/2012 10:44:30 AM
   
Filter Query Repeater with Document Value
Hi, I have added a field to the Events Booking document type of course code What I would like is when a visitor looks at a course (and there are multiple courses sharing that same course code), the query repeater will list those courses.

Now I have chosen an SQL query to list all document types, and I imagine that I need to include a WHERE clause to select the course code of the existing document, but I just don't know how to do it. Can anyone help me?

User avatar
Kentico Support
Kentico Support
kentico_janh - 9/3/2012 4:36:27 PM
   
RE:Filter Query Repeater with Document Value
Hello,

If your SQL query contains macro for where conditions, then all you need to specify in the WHERE condition property is a column name of your custom field and compare it with some value like:

MyCustomField = 'course51'


Best regards,
Jan Hermann

User avatar
Member
Member
paul.truman-sunmed.co - 9/4/2012 3:14:33 AM
   
RE:Filter Query Repeater with Document Value
Hey, is it possible to use a dynamic value from the page that they're on? So I could use the repeater with any course, not just a specific one?

Many thanks :)

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 9/4/2012 10:59:45 AM
   
RE:Filter Query Repeater with Document Value
Sure you can! Just use a K# macro expression in your where condition. Since the repeater will be placed in the context of the current document, you can access the properties directly like this:

"YourColumnName = '{%YourCurrentDocumentColumnName%}'" you might want to use some things in your query that you don't get a SQL exception if that value is blank. I am on my phone right now, so adding a link would be difficult for me, so I'll just recommend that you google Kentico Macro Expressions and Kentico K# for reference.

User avatar
Kentico Support
Kentico Support
kentico_janh - 9/4/2012 4:43:00 PM
   
RE:Filter Query Repeater with Document Value
Hello,

Yes, you can take advantage of context macros (for document's fields) or query string macros (for values from the url). Please follow the link below to our documentation:

Types of macros

Best regards,
Jan Hermann