Site structure
Version 5.x > Site structure > Blog post repeater View modes: 
User avatar
Member
Member
jacbar - 4/20/2012 3:18:05 AM
   
Blog post repeater
Hi,
I would like to create repeater which will show posts only from current day. What should I do?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 4/20/2012 4:18:37 AM
   
RE:Blog post repeater
Hello,

You need to specify a custom where condition. This where condition can be constructed with the help of amacro, which will create the correct condition for selecting the articles created on that day. You can check the field BlogPostDate for that matter. For example the where condition below should work:

BlogPostDate > '{%CurrentDateTime.AddDays(-1)%}'

Best regards,
Boris Pocatko

User avatar
Member
Member
jacbar - 5/28/2012 2:52:42 AM
   
RE:Blog post repeater
When I i.e. use such macros " BlogPostDate < '{%CurrentDate%}' " there is no problem, and in sql query is noraml date. But if I add BlogPostDate < '{%CurrentDate.AddDays(-1)%}' or macro you specified in post, the condition in sql query is empty (BlogPostDate < ''). Where is the problem with macros, or I should specify my own macro?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 5/28/2012 8:04:41 AM
   
RE:Blog post repeater
Hi,

could you please try to insert following SQL code into Where condition property:
blogpostdate> DateAdd([day],-1,GetDate())

The parameter -1 that method Dateadd should return current date - one day. You can modify parameter according to your needs.

Best regards,
Ivana Tomanickova