Kentico CMS 6.0 Controls

Using control properties to set query clauses

Using control properties to set query clauses

Previous topic Next topic Mail us feedback on this topic!  

Using control properties to set query clauses

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

If you wish to maintain the functionality of the control properties that set query clauses when writing a custom query to be used by the controls in this section, you need to make sure it contains the appropriate macro expressions that are dynamically replaced with the values of the corresponding properties at run-time. The following table maps the query clause properties to their respective macro expression:

 

Property

Expression

OrderBy

##ORDERBY##

SelectedColumns

##COLUMNS##

TopN

##TOPN##

WhereCondition

##WHERE##

 

So a query that selects page (menu item) documents would look like this:

 

SELECT ##TOPN## ##COLUMNS## FROM View_CONTENT_MenuItem_Joined WHERE (##WHERE##) ORDER BY ##ORDERBY##

 

Dynamic insertion of WhereCondition parameters

 

The controls in this section also support dynamically inserted parameters into the WhereCondition property:

 

You can use context macro expressions that are resolved at run-time, such as the following:

 

Expression

Description

{%currentaliaspath%}

Alias path of the current page.

{%currentculturecode%}

Culture code of the user's preferred content culture.

{%currentsiteid%}

SiteID value of the current site.