Calculate total cost

0
Hi, Im trying to create an app that calculates the total cost of a given activity. I have the cost per hour of this activity and the total hours. Is there any way to calculate the total cost and show it? Thank you.
asked
1 answers
5

An easy way to do it would be to add an on-change nanoflow to the fields of the price per hour and the number of hours. Then, add the following actions in the nanoflow:

  • Check if both the price per hour and total hours are filled, otherwise, set total price to 0.
  • If both are filled, do a change object activity. In the attribute change for total price, do $object/totalhours * $object/priceperhour
  • Your field should now update with the total price.

 

You could also consider hiding the total price field until both fields are filled so that users are not confused by the price showing 0.

answered