Views Simple Math Field

Categories

Component ID

2832254

Component name

Views Simple Math Field

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

1466

Component created

Component changed

Component body

Based on https://www.drupal.org/project/views_cumulative_field, this module allows you to perform simple math expressions on two Views fields.

I created this because Drupal 8 Ctools does not currently have the Global Math Expression field that it had in Drupal 7. I think the Ctools approach is much better than this, but for minor use-cases, this may be all you need.

Instructions

After you enable this module (you may need to run cron/clear caches):

  1. Create/edit your view.
  2. Add two fields that output numbers. These will be the two values on which your will perform an operation.
  3. Add the "Global: Simple Math Field" field (created by this module)
  4. Select the two fields and the operation to perform.

That's it!

Known issues

  1. This Views field is designed to be an integer, so you may have issues shortening long decimals.
  2. This Views field does not respect rewrites of the two data fields.

Contributing

If you are interested in helping out with this module, please submit patches or contact me directly.