I have several currency fields in a form. Now I would like to have a sum field, which shows all currency fields from the form calculated together. Which field type do I have to choose and what do I have to set?
Announcement
Collapse
No announcement yet.
Currency field sum
Collapse
X
-
Hello,
Create the field any numeric type and write the desired formula in it.
entity\sumRelated
entity\sumRelated(LINK, FIELD, [FILTER])
Sums related records by a specified FIELD with an optional FILTER.
Example:
entity\sumRelated('opportunities', 'amountConverted', 'won')
More detail about formula here:
- Likes 2
-
Many Thanks. I have now understood that, see screenshots. I have 5 currency fields in my form. Therefore I wrote 5 script formulas in the corresponding entity. Now I still need an output field where the total of these 5 currency fields is displayed. What do I have to set in this currency field or solve with a script so that the total amount is displayed there?2 Photos
Comment
-
Hello,
I think perfect to use field "Description" where was display sum of all your field.
For example:
totalGiftsValue = entity\sumRelated('opportunity', 'opportunity.giftAmount');
A similar question has already been met on the forum:
https://forum.espocrm.com/forum/gene...r-entity-field
https://forum.espocrm.com/forum/general/62829-calculate-sum-value-in-opportunitiesLast edited by DEN; 05-10-2021, 01:46 PM.
Comment
-
Thanks, but I don't understand exactly what to do. I don't want a sum of different projects, but a sum of a project with several parts. I have a project form, there are five currency fields listed. Then I created another currency field, in this field the amounts from the five fields mentioned above should automatically be output as a total. Perhaps the picture illustrates a little more precisely what I am imagining.1 Photo
Comment
-
- Likes 1
Comment
Comment