Developer forum

Forum » CMS - Standard features » Index Query - Date (year range)

Index Query - Date (year range)

Hans Ravnsfjall
Hans Ravnsfjall
Reply

We have a solution with itembased news articles. These newsarticles each have a specific date.

On a filtering page - based on index - we want to be able to filter newsarticles from at specific daterange. Eg. newsarticles 2014 to 2017.

I have created two parameters (minYear and maxYear). So in the query, it should be articles from equal or after minYear (2014) and before or equal maxYear (2017).

However, this is only the year and not an entire date, as the newsarticles (eg. 08-08-2016).

As far as I now - In the index,it is not possible to somehow convert the date field to be year only?

Or do i have to convert the minYear and maxYear to full dates for the query? Eg. (01-01-2014 to 31-12-2017)

Any suggestions on how I solve this?

/Hans


Replies

 
Claus Kølbæk
Claus Kølbæk
Reply
This post has been marked as an answer

Hi Hans

You will have to do a conversation somewere, either from your datefield to a year (int) or as you mention yourself change 2014 to the date type 01-01-2014.

The simplest it prob. changing your minYear and MaxYear as the other solutions likely would require you to either save the year on the items, or extend your builder.

Votes for this answer: 1
 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Thank you Claus -- I convert the date in the query to a datetype format, and that works as intended 👍

/Hans

 

 

You must be logged in to post in the forum