Filter based on single number found within a range?

Filter based on single number found within a range?

christopheriouschristopherious Posts: 2Questions: 0Answers: 0
edited November 2010 in General
I want to filter a table based on a column that contains ranges of numbers in each cell (for example, "400-424"). Users inputting "401" or any other number that happens to be in that range would return the row, any number falling outside the range would return some other applicable row (e.g. "801" would return a row containing "800-824").

Anyone care to point me in the right direction? Examples would be very welcome, as my jQuery is pretty weak at this point (as is my knowlege of regex).

I did see a range filtering example on this site, but it looks like that asks the user to input two numbers instead (the range) rather than a value inside the range but that doesn't actually appear in the cell.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You would need to do something rather like the range filtering example, except it would require a little more processing. You would need to break apart the string with the rage (i.e. on the dash) and then check to see if the filter value is in between the two - then return the appropriate result (true or false).

    Allan
  • christopheriouschristopherious Posts: 2Questions: 0Answers: 0
    Ah, thanks! I can visualize exactly what you are talking about, but my lack of experience leaves me floundering. Hopefully I will have enough time to work through the details on my own.

    Thanks for the pointer!
This discussion has been closed.