Hi - can anyone help me with the computed code and display code with the 'Computed Content' feild in CCK.

Ideally I would like the computed field to produce a unique number, and to increase it sequentially for each new node. So just something that starts with, say, 100 and goes up to 101, 102, 103 etc with each new node created. This is going to be used as a user id of sorts.

I would like the field to display as a number (101 etc) which will hyperlink to the node itself.

I'm a novice in PHP and so far have not been able to get anything to work.
Scott

Comments

lsommerer’s picture

Is there a reason you can't use the Node ID? They will be sequential, but not contiguous. Maybe that works for your situation and maybe not.

gavin_s’s picture

I would love to use the nid but it's not available at the time of creating the node. If there is some code I can use to get it at submit time that might work.... help :)

mshaver’s picture

I'm looking for the same functionality within a content type and don't feel the NID does the trick. There are many situations where a unique number within a content type could be important to have. Has anyone done this with computed field?

emdalton’s picture

The reason I need a separate sequence (besides not having the node id available at time of node creation) is that I'm going to have to compress to an alphanumeric string as it is to get within a 3 character limit imposed by an external process that I can't change. I can convert numbers up to 36^3 to 3-char alphanumeric sequences, but nodes on our site are already up past 4000. Besides which, my users would really like the generated numbers to follow a sequence.

The implementation should be much like that for "case number" in the Case Tracking module. A CCK field that increments per type would be ideal.