Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Content Filter > Where Condition > Macro ... View modes: 
User avatar
Member
Member
dchaffin-dreamcc - 6/29/2012 9:02:26 AM
   
Content Filter > Where Condition > Macro ...
I have the following in a where condition of a Datalist with custom query and it works great (with one exception) ...

DATEPART(yy, SortDate) = {%year|(default)2012%} AND DATEPART(mm, SortDate) = {%month|(default)6%}

Obviously, I don't want to have to change this condition every month, but would like to use something like DateTime.Today.Year.ToString() and DateTime.Today.Month.ToString() to replace the '2012' and '6' in the above. However, I've been unable to discover the syntax that would make this work.

Can anyone help with this?

Thanks.

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 7/1/2012 4:04:02 PM
   
RE:Content Filter > Where Condition > Macro ...
Hi,

here is an example which may help:

(MONTH(NewsReleaseDate) = MONTH(GETDATE())) AND (YEAR(NewsReleaseDate) = YEAR(GETDATE()))

NewsReleaseDate is a datetime field. So change only this field and condition should work.

Best regards,
Ivana Tomanickova