Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By agnez on
Hello,
I don't know how to realize this :
An integer or decimal text field where it should be able to add and substract amounts, and keep track of when what was changed.
I would need to show a final number to some users, and the history of how we got to that number to others
example:
sum = 5
full history =
+1 13/12/29
+3 14/01/01
-2 14/02/20
+3 14/03/30
Any ideas how this could be done ?
cheers
agnez
Comments
Hi, you could do that with
Hi, you could do that with field collection and some custom code.
1- add field_sum as field collection in a node.And in that entity add an integer in field and a date field.
2-add following code in custom module
3- Images viewing node http://i.imgur.com/lRz3xGi.png
4-images adding node http://i.imgur.com/pSj9nKz.png
5- You could see the sum.
I hope it helps you. if any question i will be glad to help you. thanks.
looks promising
Hey alinouman,
thanks a lot for your replie !
It looks really promising, but is not yet working for me.
SUM is staying on 0 and I get this error message:
Undefined property: FieldCollectionItemEntity::$field_value in mymodule_node_view()
and it points me on this line of your code :
$result+=$f->field_value['und']['0']['value'];
Would you know what blocks?
Cheers
agnez