Converting text input fields to number (for range searches) removes leading zeros
I converted our zip code fields to numbers in order to do a range search on our alumni directory. Unfortunately, this removed leading zeros for a whole bunch zips on the east coast. Has anybody found a way to make this work?
Replies
Low 26 Mar 2015 08:29
Technically, a number with leading zeros are strings, so setting the field to store 'number', 'integer' or 'decimal' will strip the leading zeros on a database level.
If you need to store the leading zeros, you will have to set the Field Content setting to All.
As long as the field contains values that are of the same length, the range filter should should work, as it will compare the values like strings, eg: '0100' < '0150' but '100' > '0150', just like 'abaa' < 'abca' but 'baa' > 'abca'
Ken 26 Mar 2015 19:29
Makes sense and makes me embarrassed to have asked the question.
Thanks for the quicky reply!
Ken