0

I have three field in a content type, date and category and amount.

Based on amount field, I created a views to get total amount (aggregator views) by category as argument.

So in this content type I want to add a computed field, which will give me cumulative total (sum of all previous amount (+) current amount, current node category as criteria).

Is is possible by adding a views inside computed field of drupal 8, or any other way (rules/sql of drupal 8) to achieve it. I am new to drupal, looking for solution for my project.

Please help me to get it done by providing ideas, codes or reference, I am not coder, I just trying to learn it!

2
  • You haven't provided enough information about what you are trying to do, but you can do basic math in twig, which is supported in Views. So you can do something like {{ my_field + 25 }} to do the math in the view itself. Nov 15, 2020 at 17:52
  • Thank you so much for your answer sir. For example I added one node with category A, and amount 100, in cumulative field I want 100 as there have no node with category A in the database. In next node I select Category A and input amount 100, so in amount field it will 100 but in cumulative filed I want 100+100 = 200, in third node If category change I want to cumulative amount based on category selected on this node. Hope you understood. Otherwise I will explain you more details.
    – Jack
    Nov 15, 2020 at 18:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.