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

merlinofchaos’s picture

Version: 6.x-2.12 » 6.x-3.x-dev
Category: feature » task

Unfortunately, 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.

carsonblack’s picture

I 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?

merlinofchaos’s picture

Right 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.

tobey_p’s picture

Subscribing. 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.

rkodrupal’s picture

i have this problem with using [tid] in the link path: taxonomy/term/[tid] for 'output this field as a link'

FluxSauce’s picture

Issue tags: +ux

Here'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.

The problem with the point and the comma as either decimal mark or digit group separator is that, internationally, they have both often been used for both meanings, and their meaning is context-dependent (one must know which notational system is being used in order to interpret them).

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.

FluxSauce’s picture

Title: Thousands separator should default to nothing when using a uid field » Thousands separator should default to nothing
Version: 6.x-3.x-dev » 7.x-3.x-dev
Category: task » feature
joachim’s picture

Arguably a bug, as it breaks ID fields.

jrsinclair’s picture

I have a similar use case to #5, and agree with the proposal in #6 - seems like it would provide something for everybody.

dawehner’s picture

Issue tags: -views, -ux, -uid

From 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.

joachim’s picture

> 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?

ericmulder1980’s picture

Issue summary: View changes

It 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?

hackwater’s picture

It'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 ''.

petednz’s picture

a 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)

FluxSauce’s picture

For whatever it's worth, I still agree with myself 3 years ago; it's a bad default.

longwave’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 7.x-3.x-dev » 8.1.x-dev
Component: user data » views.module

After 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.

dawehner’s picture

Can'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.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

anthonylindsay’s picture

Interestingly, 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.

Lendude’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 8.5.x-dev » 7.x-3.x-dev
Component: views.module » Code

This is no longer an issue in D8, there the default is 'None' when adding an ID field.

Bumping back to the Views queue.

webdevfreak’s picture

I 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.