Hey, wondering if the length of the serial field can be specified? I require a 5-digit serial for one content type, and a 7-digit serial for another. Thoughts?

Comments

emcniece’s picture

I suppose this could be initialized as a starting number... for example, the 5-digit number could be started at 10000, and the 7-digit number could start at 1000000. Any way to adjust the starting number of the serial?

emcniece’s picture

Status: Active » Closed (duplicate)

Yep, found the other thread(s).

FaBMak’s picture

I'm looking for something like this, but i'm case i need the change the format of the Serial. Instead of 1, should be 0001.

Is this possible?

aalireza’s picture

Issue summary: View changes

i want something like this , how can do this ?

zwerg’s picture

It's not a duplicate because this applies to v7.x, not to the 6.x version of serial field.

Is it possible to change the serial length through the UI like the patch in v6?

zwerg’s picture

Status: Closed (duplicate) » Active
zwerg’s picture

Status: Active » Closed (fixed)

Found a solution using computed_field in https://www.drupal.org/node/2055161.

If you want to set up a starting number like 1000000, you need to add this via "+" in the computed code, e.g.:

$entity_field[0]['value'] = $entity->field_serial[LANGUAGE_NONE][0]['value'] + 1000000;