Views Simple Math Field
The Views Simple Math Field module creates a Views field handler that enables the user to perform simple math expressions based on two of the user's view's fields.
For a full description of the module, visit the project page.
Submit bug reports and feature suggestions, or track changes in the issue queue.
Table of contents
- Requirements
- Recommended Modules
- Installation
- Configuration
- Maintainers
Requirements
This module requires andileco/eval-math
(https://packagist.org/packages/andileco/eval-math).
Recommended Modules
Note: Twig can do math, but it's better to perform math with PHP. This field is especially useful for site-builders who want to avoid Twig or who have a module like Charts that responds better to this module than a field rewrite.
Installation
Install as you would normally install a contributed Drupal module. For further information, see Installing Drupal Modules.
Configuration
- Navigate to Administration > Extend and enable the module.
- Navigate to Administration > Structure > Views and either create or edit a view.
- Add two or more fields that output numbers.
- Add the
"Global: Simple Math Field"field (created by this module). Check as many fields as you need, and then add them into the text area where you can write formulas with the fields, such as '(@field_one + @field_two) / @field_three'. Apply and save.
Please note: After you enable this module you may need to run cron/clear caches.
Maintainers
Supporting organization: