Skip Navigation

[Resolved] URL parameter filter gives inconsistent results in a View

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a View that is filtered by a custom field value, set by a URL parameter. The results should include posts that have a custom field value less than or equal to the number I pass into the URL parameter. The results do not seem to be accurate, because param=999 gives me 3 results but param=1000 gives me no results.

Solution: Check the query filter settings. The compare value type should be "UNSIGNED" instead of "string" when comparing numeric values.

Relevant Documentation:
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/#compare-value-type

This support ticket is created 6 years, 9 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by davidZ-4 6 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#679359
urlparm issue in view.JPG

I am trying to: display woocommerece products based on a view that get urlparm (query string) of price and display max 5 products with price equal or less than the price defined in the urlparm

Link to a page where the issue can be seen: hidden link

I expected to see: no products listed on the page

Instead, I got: 3 products with price higher than 999 display on the page

i noticed that there is a range of price this is happen
for example"hidden link
will get no results as expected.
however if i change urlparm to 20 like this
hidden link
i will get one result
if i use hidden link
i get three results
if i use hidden link
i get no results as expected

i have only 5 products in the store with variations of max 2 variations to each of four products and one product with no variations.

you can see the view search setting in the enclosed image

Please advice,
thanks,

David

#680634

In the custom field filter area, change the "string" option to "UNSIGNED" so that the values are compared using a numeric algorithm. Then try again and let me know if this does not resolve the problem.

#680773

Hi Christian,
I changed this to a number and its working just fine.

Thanks,

David