Is there a way to do math inside of an item in a list?
I’ve got a thing Journal.
Entries in Journal contain a reference to an entry in thing Food and a number to multiply by.
So the journal would be read “on this date I ate 500g of this Food”
The Food thing has a long list of nutrients.
At the moment what I’m trying to do is add up how many of each nutrient someone ate over a time period. So taking a list of Journals.
- nutrient 1
- nutrient 2
- nutrient 3
The problem is that I want to multiply a field under Food by a field under Journal and then add the result for that nutrient from each Journal.
list = search for Journal
- journal 1
- journal 2
- journal 3
total nutrient 1 = (Journal-1-nutrient-1 * journal-1-times) + (journal-2-nutrient-1 * journal-2-times) + (journal-3-nutrient-1 * journal-3-times)
total nutrient 2 = (Journal-1-nutrient-2 * journal-1-times) + (journal-2-nutrient-2 * journal-2-times) + (journal-3-nutrient-2 * journal-3-times)
total nutrient 3 = (Journal-1-nutrient-3 * journal-1-times) + (journal-2-nutrient-3 * journal-2-times) + (journal-3-nutrient-3 * journal-3-times)
Can I build an expression to get each of these totals off of one search that returns the list of journals?