I want to use the computed field in my drupal 8 website to calculate the charges for a parking system where I calculate the charge for a vehicle by taking the date of collection minus the date of parking, multiplying by the charge per day. total-charges=(collection-paking)*charge-per-day. However, even before I do the calculation, I tested to see if the computed field is working by assigning the $value='hello' and the assign the $disply_output=$value but its not being displayed in the content of the node together with other fields. Other things done to try to resolve this issue

enter image description here

  • Change the data type from varchar to text to int and others
  • Change the settings in the 'manage display' option of the content type. From toggling sanitize on an off, change display of the computed field from above to inline, etc
  • Resave the node by clicking edit and then saving the node, and even creating a new node of that content type after adding the content field.

Still not working.

After googling, most common solution, which works for drupal 7 guys is to uncheck the option to save the field in the database. But I dont see that option in drupal 8 so that I can uncheck it. Because I do not want to store the value in the database since It changes everyday a vehicle is not collected, so all I want is to calculate the value on the fly and charge the vehicle owner when collecting the vehicle. How do I make the computed field even display a simple 'Hello World'?

  • Do you want a total charges field on the node that is filled with a value based on other fields once you save the node? Is that what you mean?
    – Amy
    Mar 29, 2017 at 13:31
  • Yea...But not exactly. The total charge wont be stored. It will be just calculated on the fly and displayed to the user. But before we even go that far, how do i even display a simple 'hello world' using the computed field, just to test that its working.
    – Sean
    Mar 29, 2017 at 19:50
  • Where is the computed field displayed? On the edit page?
    – Amy
    Mar 29, 2017 at 20:27
  • No...on the view...Like usually on the edit page, its a hidden field by default, such that after populating the database, when you now want to see what was populated, you get the computed field as well. Like say for a normal article, after you create and save the article, when your go to the home page to view it, the computed field will be displayed together with the body of the article
    – Sean
    Mar 29, 2017 at 20:39
  • Sorry for misunderstanding (hopefully I'm getting close :p) So for example, if you have a parking content type, you want a field that stores the price per day. And then a date field showing the day of collection. And then when you visit the node it displays a value showing the 'price per day' * the number of days that have past since collection? And you want this displayed when you visit the node right?
    – Amy
    Mar 29, 2017 at 20:48

2 Answers 2


I think it must be a bug, since the computed module is in alpha for drupal 8 at the time of this writing. With the help of Matt, we were able to print a simple 'hello' message by manually creating a new node. This new node will have access to the new computed field. I was using the devel module to generate content for nodes, which for some reason did not have access to the computed field. So if you are experiencing the same problem, set up your computed field, and then manually create a node, or edit and resave a node your previously created manually. That worked for me.


You just need to resave existing data and computed field value will be shown and saved

  • It seems like to me like the first answer already explains it. I am not sure this answer is adding anything. Maybe you could consider adding a comment to the previous answer, you could suggest an improvement or ask for clarifications. Sep 24, 2018 at 21:55

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.