Skip Navigation

[Resolved] Query filters aren't working as expected

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by josephQ 6 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#923735
2006-2010 filter settings.png
2011-2015 filter settings.png
2016-present filter settings.png

I have a custom post type named Exhibition. It has some fields on it, including a Start Date and End Date. The fields are Date Pickers and just store month, day, and year values.

My site has 7 Exhibitions pages. I created three views for them:

+ Past Exhibitions (2006-2010)
View: hidden link
Webpage: hidden link

+ Past Exhibitions (2011-2015)
View: hidden link
Webpage: hidden link

+ Past Exhibitions (2016-Present)
View: hidden link
Webpage: hidden link

(Screenshots are also attached.)

The Views associated with them use the Start and End Dates to grab just the exhibitions during the relevant time periods. The
problem is that they're not working as expected. On the webpages, they all say "No items found." Can someone investigate?

Thank you!

--

On a related note, it would be nice if in the query filter I could re-use the same field like I can in a SQL query to say, "find records whose price is greater than 50 and whose price is less than 100."

#923914

Hello,

Thank for the details, I have done below modification in your website:
Edit the view "View - Exhibitions - Past Exhibitions 2006-2010 - Index"
hidden link

In section "Query Filter", change the filter from value type from "DATE" to "UNSIGNED", from

Select items with field:
Exhibition Start Date is a DATE greater than or equal DATE(01, 01, 2006)
AND
Exhibition End Date is a DATE lower than or equal DATE(31, 12, 2010)

To:

Select items with field:
Exhibition Start Date is a UNSIGNED greater than or equal DATE(01, 01, 2006)
AND
Exhibition End Date is a UNSIGNED lower than or equal DATE(31, 12, 2010)

You can test it here:
hidden link

More help:
https://toolset.com/documentation/user-guides/date-filters/
when inserting a query filter to test a date custom field you should use the UNSIGNED option.

#924024

Ah, wonderful! That did the trick!

Thank you!