0

how do I use existing Serial field in other content types with same counter db table? Have 2 CCKs, cck-A has a serial field (auto increment) (ParticipantNumber), added same ParticipantNumber serial field (add existing field) in cck-B. But the serial field value for both CCKs have independent auto incremental value.

How do I make the ParticipantNumber values be incremental (and Unique) across cck A and B? (just like node nid)

  • Or if it is not possible, how else can I achieve to have same field that is auto incremental across cck A and B? – Maddy Jan 19 '18 at 1:33
  • They have the same field machine name? – No Sssweat Jan 20 '18 at 7:33
  • yes they have, I mean I am using the same field in both the content types. I used "Add existing field" while adding the field in second content type.. – Maddy Jan 22 '18 at 23:31
0

Instead of Serial type, I added Integer field, and added the same field (add existing field) in other content type as well. And In the hook_entity_presave, I query for the MAX(field_value), increment and assign for the current node/entity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.