Forum Academy Marketplace Showcase Pricing Features

Number in numeric range: can't find a solution

I have this list of products here, and I want to filter them according to the salary value.

This salary value needs to be in a numeric range. So:

  • I create a numeric range custom state (I do this because in the original app I take the values from a reusable element, so the custom state must be in the logic of the app)
    – when the apply button is clicked the custom states numeric range value is updated according to the values entered.
  • Then I use the min and max of this custom state to filter for the results.

However, I get empty results at first. Moreover, when I write values in the min and max field I do get results when I press it.

Does anyone know why this happens?

Hi there, @sensei01… when I first looked at your page, it seemed like your setup should work given that you had checked the Ignore empty constraints box. After playing around with it for a bit, I noticed that the defaults of the min and max values of the numeric range are actually 0 and 0 as opposed to being empty, so I am guessing that’s why it doesn’t work (i.e., when the page loads, the repeating group is looking for products with salaries in the range of 0 to 0, and that obviously won’t return any results). I took the liberty of making a change to use two custom states instead of using the numeric range, and now the filter is working as expected.

So, I could be wrong about the numeric range thing, but that’s what I think is happening. Hopefully someone else will chime in if they know differently.

Hope this helps.

Best…
Mike

hey @mikeloc thanks for the reply.
sorry, I undid and redid sth since, the filter was working, but I could not see what you had changed. could you please specify what did you change since what I think you are referring to actually has an empty default value?

I believe it wasn’t working because of the custom state that is a numeric range. I added two new custom states (called min and max), and I put these constraints on the repeating group’s search.

:slight_smile: ok thanks. makes sense