Closed tmuka closed 6 years ago
Ok, after digging a little deeper i see that $is_numeric_sort argument already exists, but i'm not sure why one of my hidden Gravity Forms fields sorts numerically and the other doesn't. The one that works has values 0-5, the one that doesn't has values 0-47. For now I hacked in a workaround for my specific case in line 1972 of gravity-forms-addons.php. Maybe this will help someone else.
if( is_numeric( $sort_field_number ) ) {
//hack to get sort by download count sorted numerically instead of alpha
if($sort_field_number == 9 && $form_id ==1){ $is_numeric_sort = true; }
I'm guessing this is a feature request, i'm wondering if there's a way to pass a flag in the sort request to treat a column as an int. I'm currently using /?sort=9&dir=DESC on a field populated with numbers, but since the mysql column type is string they sort alphabetically.
The query that returns them in the order i like is something like this (notice the "1+value") in the orderby that forces an implicit conversion. SELECT * FROM
wp_rg_lead_detail
WHEREform_id
=1 ANDfield_number
=9 ORDER BY 1 + value DESCThanks! Tony