I am trying to:
Sort numeric fields correctly.
Views is sorting based on the front digit. All the fields with "9" in front are considered the largest with the largest. However, in my data, there are fields which are at least 10x larger.
For example, in the fourth column, Views is seeing 964,870 as the biggest number but in my data, 50,779,054 should be the biggest.
Here is the test page - hidden link
Stan
Hi Stan,
Thanks for contacting Toolset support.
In order to assist you with that the sorting issue, I'll need to know what kind of field type you are using? Is it Numeric Field or Text Field. Also, is the Field is created using Types or not.
Hi Anton,
Yes, it is a numeric field by Types.
I'll need to request temporary access (WP-Admin and FTP) to your site
– preferably to a test site where the problem has been replicated if possible –
in order to be of better help and check if some configurations might need to be changed
Your next answer will be private which means only you and I have access to it.
❌ Please backup your database and website ❌
✙ I would additionally need your permission to de-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.
Hi Stan,
I debugged your issue, and I found that issue comes from the comma in the custom field value. Because of the comma it works as string and not as number. Therefore you should remove all commas from the custom field value.
Those with , should be a number too. I have two questions:
1. How can we make this to be a number?
2. I can remove the commas from the numeric custom fields but how can I add comma via CSS or JS so it still shows the comma but doesn't effect the custom field?
Hi Stan,
1. How can we make this to be a number?
⇒ You are already using number field and as we said in order to make this field working in order by clause as number field you simply need to remove the comma from your field value (which you already did).
2. I can remove the commas from the numeric custom fields but how can I add comma via CSS or JS so it still shows the comma but doesn't effect the custom field?
⇒ For such customization, you need to build custom shortcode to display your number field in your desired number format.
Here is the reference ticket link that may help you: https://toolset.com/forums/topic/allowing-number-format/#post-374263