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)

3
  • Or if it is not possible, how else can I achieve to have same field that is auto incremental across cck A and B?
    – shablm
    Commented Jan 19, 2018 at 1:33
  • They have the same field machine name?
    – No Sssweat
    Commented Jan 20, 2018 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..
    – shablm
    Commented Jan 22, 2018 at 23:31

1 Answer 1

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 and acknowledge you have read our privacy policy.

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