# Calculate a value: support strings, lists, & files

 Project: Rules Version: 7.x-2.x-dev Component: Rules Core Category: task Priority: normal Assigned: Unassigned Status: active Issue tags: data transforms, lists and loops

## Issue Summary

Let's unify all the data related actions (except 'Add a variable' and 'Set a data value') into the 'Calculate a value' action by implementing cases for string, list, and file data types alongside the existing integer support. Each calculation would support a pair of inputs or single value and NULL for each data type by performing the appropriate operation to calculate a desirable output based on the data types inputed. If a constructed logical operation isn't supported, then a graceful failure would be in order.

95% of the operations I a propose to incorporate here are already done and linked (a few of which twistor and I did for #745314: Action: transform text); what's left is to merge all of it into one very valuable action. Then we will also need an upgrade path for the existing 'Add / Remove an item to/from a list'.

This plan started out simply as an attempt to provide a simple, yet robust improvement to the current method of combining two strings, ie "[first name] + [last name]", using the token input with a space between two values. ...But then I thought about that other issue... investigated a little further, and everything seemed to line up perfectly...

### The Plan

• + Addition {Plus Sign} : Combinations and Appendages
• - Subtraction {Minus Sign} : Differences and Removals
• × Multiplication {Product Symbol} : Commutations and Joins
• ÷ Division {Obelus Symbol} : Distributions and Splits
• ### Related functions

It will also be possible to reuse the functions above for creating more complex operations, like mean and multiplicative inverse and Cartesian product, though these can also be directly implemented with the action. Sorting and reversing lists and strings is already implemented to work numerically and alphabetically would lend to this and is as well, see #745314: Action: transform text.

For more wiki reading, see String operations, String functions, Operations on Functions.

### #1

 Component: Rules Core » Rules Engine

Date API issue: #298334: Repeating dates in separate nodes. Added.