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...
- Integers: Adding two numbers
- Two strings: Appending one string with another #1539452: how to make a rule to add (append) data to a longtext field
- A single list: combining multiple items of a list into one element Combine list items into a string
- Two lists: Put them together one after the other?, also #1386370: How to: sum of integer values in a loop?
- Two files: eg. pdf's could be merged
- Integers: Getting the difference between two numbers
- Strings / Long texts: Get two versions of a text Diff, #1343442: Condition : "Text contains any word in a list", and this python discussion
- Single list: Split a string into a list
- Multiple Lists: #1252860: Action: Differences between lists. Set difference and Calculus of subtraction
- Date/time intervals: could produce, user 1 posted [node:title] 10 min before he posted [node2:title] (or done manually with date to integer conversion).
- A single integer: #1525582: Action: generate a list from an integer
- A string and a number: Multiply the occurrences for an element of a list by a factor, ie repeat something a number of times (perhaps a great solution for repeating date field data, See Date API issue: #298334: Repeating dates in separate nodes)
- Two strings: stackoverflow: multiplying strings
- Strings and lists: Cartesian Product, see deck of cards example
- Two lists: Permutations, Multiplicative inverse of two lists (those two require implode then explode afaict)
- Previous two: I need to read up more on these. Related symbols / concepts: asterisk, dot product, tensor product | *, ·, ⊗
- Integers: Dividing two numbers, see #1479526: Action: modulus, ceiling, floor (rounding)
- List and integer: Divide a list into a group of strings
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.