Is there a solution to calculate rows? in bases
like the sum() function?
I came here with the same question. My use case is to calculate the total cost of parts on the bill of materials for a robot I’m making. I have a note for each part, with some properties like quantity and price. I added a calculated column (quantity * price, easy) but now I’d like to sum all those to get the total cost.
Look at this. It’s just begging for a sum!
Indeed , have the same here, should be so handy. nice table you have created ..
The closest I’ve gotten is
list(inventory.asFile().backlinks).filter(value.asFile().properties.inventory == inventory).map(value.asFile().properties.$)
which shows the price of each item as a list, but does not get a sum.
Sums are not available in bases yet, but they’re on the roadmap. Once that update comes through this should be much easier.
To break down my formula:
For starters, the formula is meant to only take information from the file in that row, so getting info about other files requires getting to them first.
list(inventory.asFile().backlinks) gets those files. In my case, all the files I care about here have the same “inventory” property, which is itself a file. So I get a list of all the backlinks from the inventory file. This is the hackiest part of this, backlinks is not a great way of doing this but it was the way I came up with and it works. If someone finds a better way please share.
.filter(value.asFile().properties.inventory == inventory) filters out any backlinks where the “inventory” property doesn’t match the current file’s “inventory” property. That should result in only the files I care about, regardless of what else is backlinked.
.map(value.asFile().properties.$) gets the “$” property from each of the files in my filtered list. This results in a list that looks like 7.26 11.22 0 26.6 20 2.95 28.5 7
Hopefully someone can take this list and figure out how to sum it.

