The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
How to Calculate (Multiply/Divide numbers) field ID totals in Views
Hi
I have seen how you can use PHP code to Calculate a Total in Views (https://formidableforms.com/knowledgebase/php-examples/#kb-calculate-a-total-in-view) by adding field IDs together.
I would like to be able to multiply and divide field IDs in Views (i.e. do some simple Excel like calculations - [sum of field_id of all forms submitted]/1000 ), rather than in the form, which I believe would involve using custom code.
Has anyone tried this yet? I'm just wondering if and how it might be done?
January 7, 2018 at 7:11 pm
Yes, I think you can.
Use this method:
SORRY, I DON'T KNOW HOW TO POST CODE HERE, PLEASE SEE THE FOLLOWING TXT ATTACHMENT
In this case, I'm substracting sums (total) of values from field 66 when 70 field is "something", from the sums (total) of values from the same field 66 when 70 field is "another something". I believe other math operations are allowed.
To insert that code in any post, page or view I'm using the PHP Code For Posts plugin.
Answer here if you still have questions.
January 7, 2018 at 7:16 pm
Here is the code for the above message. If someone would like to explain to me how do I insert code in this posts, I would be very thankful.
Attachment:
php-code-for-operations-with-fields.txt
Discussion closed.