1
votes

I'm new to Orchard CMS and trying to create a query that will filter a list of upcoming events date. What I want to do is filter a list of upcoming events. I have set up a list and plan to use the creation date (setting the date to the event date) as filter. Where I have ran into an issue is getting the filter value to work. When I set the filter value to {DateTimeField.Date} for get the current date or any of the other date options, the filter does not work. It show all events. When I manually type in the value field "2014-08-20", it works. Any ideas of why I can not set the date to the current date?

I have also tried creating just a date field within the content definition and received the same issue as above. I do plan to create a Event End Date that will not show, but will be used to filter. I assume the value will be very similar though to what would be needed for the creation date though.

I am using Orchard CMS 1.8.0

Any help will be greatly appreciated.

1
I'm quite confused by your question. Can you explain what exactly you are expecting to happen and what you're trying to do? What is DateTiemField? Where are you using that? - Bertrand Le Roy
I am trying to create 2 separate queries for 1 list. One query will display events that are upcoming and the other will display past events. The events are only just a date and a title. For one query I have set a filter to "Show items from the following list: Events". A second query I have is "Creation date is greater than {DateTimeField.Date}". With this query I receive all items within my list, even though the creation date for some of these items are dates that have already past. When I set the last query to be "Creation date is greater than 2014-8-21" the query works correctly. - Joe P
I mean, what do you expect the value of {DateTimeField.Date} to be? DateTimeField, in this token description, stands for an actual date time field token. So for example, {Content.Fields.SomePart.SomeDateFieldOnThatPart.Date} would be a valid instance of that token. I think what you're looking for is the current date, which would be given by {Date}. - Bertrand Le Roy
Yes, I am trying to compare the date stored for Creation Date with today's date. When I tried {Date} I receive the same output, all for listings. When I entered 2014-8-22, I received just 2 items, which would be correct. I do appreciate your help with this matter. - Joe P
Got it figured out. I needed to use {Date.Format:yyyy-MM-dd}. I assume the format that {Date} was not in the same format. Thank you @Bertand-Le-Roy for your help. I now better understand the queries feature since to you. - Joe P

1 Answers

2
votes

The current date can be obtained in Token form like this: {Date}. That token itself can be modified as a date token. In particular, it can be formatted. In your case, because the filter will construct a HQL filtering clause from your expression, {Date.Format:yyyy-MM-dd} will put the current date into the right format.