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); 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
- 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 ?
- 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, , and this python discussion
- Single list: Split a string into a list
- Multiple 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:
- 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: )
- 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
- 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 .