Not sure if this is a feature request or bug report but I think that when a uid field has been used in the fields the Thousands separator field should default to nothing instead of the comma. The reason for this is that you would never want the uid output with a comma in it as that would always be an invalid uid.
As an integer field it does make sense why the thousands separator shows up and I think it should be there.
I also realize that this is a bit of a convenience feature because, if you're paying attention as a user, you would think about this and know to remove the comma from the field. Alas, I know of some site admins that are rushing through building views and not thinking to remove this and as soon as uid hits 1000 things start breaking.
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedUnfortunately, changing the defaults would actually require a custom handler just to do that, or some other changes to the handler to make it smarter. So it's not quite as easy as that.
That said it's not a bad idea to do this.
Changing to active task. Would need a developer interesting in writing this.
Would not be considered for 2.x, only 3.x.
Comment #2
carsonblack CreditAttribution: carsonblack commentedI wish I was more familiar with the views code to be able to say I could handle writing this, but I am not. Maybe I should be? ;-)
If I can find the time to dig into I will on 3.x. But it is going to be pretty low on my priority list. Perhaps there's a place where I could at least document the issue somewhere besides the issue queue?
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedRight now the 'active task' list is the best place. It's rather long. Every now and then I publicize it, hoping for some development, but the Drupal community is all quite busy.
Comment #4
tobey_p CreditAttribution: tobey_p commentedSubscribing. I have this Problem on a production website using Views 6.x-2
I'll investigate that problem and hopefully can provide a possible fix.
Comment #5
rkodrupal CreditAttribution: rkodrupal commentedi have this problem with using [tid] in the link path: taxonomy/term/[tid] for 'output this field as a link'
Comment #6
FluxSauce CreditAttribution: FluxSauce commentedHere's a counter-proposal - why not default thousands separator to nothing?
Not all users are in the USA, which uses "," as a thousands separator. For example, "." and " " are valid separators; " " is recommended by the International Bureau of Weights and Measures.
http://en.wikipedia.org/wiki/Decimal_mark#Digit_grouping
Additionally, operations that rely on an identifier - like a generated URL - are broken by this default when the ID exceeds 999 (root cause of carsonblack's issue).
As the controls already exist to manipulate the thousands separator, I feel that it should default to nothing, leaving the customization up to the user.
Comment #7
FluxSauce CreditAttribution: FluxSauce commentedComment #8
joachim CreditAttribution: joachim commentedArguably a bug, as it breaks ID fields.
Comment #9
jrsinclair CreditAttribution: jrsinclair commentedI have a similar use case to #5, and agree with the proposal in #6 - seems like it would provide something for everybody.
Comment #10
dawehnerFrom my perspective i would totally agree here, there should be no thousand seperator by default.
The only problem is that views doesn't allow you to change the default value without changing existing views.
If we choose to change the default value, all views which expects the thousand operator to be enabled will change.
Comment #11
joachim CreditAttribution: joachim commented> If we choose to change the default value, all views which expects the thousand operator to be enabled will change.
That's what change notifications are for -- tag it as 'affects site builders' :)
Also, don't default values get saved into the handler options array as soon as you save the view? Or has that been changed recently?
Comment #12
ericmulder1980 CreditAttribution: ericmulder1980 commentedIt seems this issue has been hibernating for a while but is actually still very active.
I have a situation where the output of an ID field is used to create an URL. This works great untill 999 but breaks at 1,000 because of the default thousand seperator.
The problem lies in the fact that in hook_views_default_views() the seperator for the field is set to ''. The default fallback to a komma kind of messes this up. Is there a way to enforce the empty seperator without editing the view on the production site?
Comment #13
hackwater CreditAttribution: hackwater as a volunteer commentedIt's possible this is a strongarm/features issue, but my views that have a numeric field seem to revert to the default separator regardless of what it was set to originally. I'm not 100% sure this is happening because of features, but to set the default in the Views code, I went into the views_handler_field_numeric class in the views_handler_field_numeric.inc file and changed the $options['separator'] default to ''.
Comment #14
petednz CreditAttribution: petednz commenteda quiet +1 for default being 'nothing' - it is frequently tripping us up and while being a minor tweak to fix when it does become an issue, it 'feels' like the default should be 'leave integers as integers' and apply any fancy formatting (such as a comma) to the user to set. (note to self: Since it is often CiviCRM ID fields that trip us up then I may be able to flag a task to deal with it there at least for d8)
Comment #15
FluxSauce CreditAttribution: FluxSauce at Four Kitchens commentedFor whatever it's worth, I still agree with myself 3 years ago; it's a bad default.
Comment #16
longwaveAfter running into this for the Nth time in Views 7.x-3.x, I checked and the numeric field plugin for Views in Drupal 8 still defaults to comma as the thousands separator. This will still be an issue in D8 if people use numeric fields as tokens in generated URLs.
Comment #17
dawehnerCan't agree more, we should certainly change that. Its super annoying actually, but i'm not sure whether it still happens in 8.0.x given that we use ordinary field formatters.
Comment #22
anthonylindsay CreditAttribution: anthonylindsay at Annertech commentedInterestingly, in Views 7.x-3.x if one selects the '-select-' option, then no thousands separator is used. That had me stumped for quite a while as I searched for the 'none' option and went down various form_alter-based rabbit holes.
So regardless of whether 'none' should be a default, it does appear to be possible to achieve. We could do with altering the text of the 'select' option though to better reflect what it does.
Comment #23
LendudeThis is no longer an issue in D8, there the default is 'None' when adding an ID field.
Bumping back to the Views queue.
Comment #24
webdevfreak CreditAttribution: webdevfreak as a volunteer and commentedI want to share my experience which might help someone i.e
In my Drupal version 7.59 project, I have defined custom fields in hook_views_data() which are used when we create a VIEW.
My VIEW started displaying comma / thousand separator once my database table records exceed 999 value which means it was breaking up several things as correct ID can not be read due to comma in id values.
Initially I have defined my custom table ID field as something below in my_module.views.inc file i.e
// User ID table field.
$data['my_module_custom_table']['id'] = array(
'title' => t('Member ID'),
'help' => t('Member ID which is linked with users database table.'),
'relationship' => array(
'base' => 'custom_table', // The name of the table to join with.
'base field' => 'student_id', // The name of the field on the joined table.
'handler' => 'views_handler_relationship',
'label' => t('Default label for the relationship'),
'title' => t('Title shown when adding the relationship'),
'help' => t('More information on this relationship'),
),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE, // This is used by the table display plugin.
'float' => TRUE,
),
);
All I have done was to remove following line i.e 'handler' => 'views_handler_field_numeric' and can see comma issue resolved.
'field' type defaults to integer unless we define and in my case when I have removed defined field i.e views_handler_field_numeric, I can see comma has been removed and it works absolutely fine.