I have two content types

For example say X and Y

Every Y should refer any one of the X . I want to display how many number of Y is refering a particular X while viewing the X node. Please suggest some module which direclty achieve this requirement.

1 Answer 1


You can either use Views and Aggregation to Sum the number of references to show on a list.

But, I recommend using the Computed Field module to write some PHP code that is run on save to store an integer value that is the count of references. This value can be cached by drupal and used within Views and other modules.

Computed Field is a very powerful field module that lets you add a custom "computed fields" to your content types. These computed fields are populated with values that you define via PHP code. You may draw on anything available to Drupal, including other fields, the current user, database tables, you name it. (Feeling the power yet? :) ) You can also choose whether to store your computed field values in the database with other content fields, or have them "calculated" on the fly during node views. (Although you should note that Views use requires database stored values.) This field is literally the Swiss Army knife of fields. So start cooking up your PHP based values!

  • Do i want to write some code after using computed field module?
    – Monish
    Apr 28, 2015 at 18:11
  • Please read the documentation page on Computed field: drupal.org/node/126522
    – tenken
    Apr 28, 2015 at 18:17

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.