Let me try understand…
-
You have a ‘central’ note with outgoing links (outlinks) to other notes. Each of these (outgoing) notes has an inline-field named “Total_amount”. (My first suggestion: remove “€” from number)
-
In the ‘central’ note you want:
a) a list/table of all (outgoing) notes and the “Total_amount” in each one?
b) the sum of all “Total_amount”?
c) both?
For option a) you can use something like this:
```dataview
TABLE Total_amount as subtotal
FROM outgoing([[#]])
WHERE Total_amount
```
* Note2:
1 - [[#]] is the equivalent to "this.file". You can change the # by the file name
2 - "WHERE Total_amount" invoke only the (outgoing) notes with the field "Total_amount"
For b), if all invoked outgoing notes have the inline-field “Total_amount”, then you can use an inline query (if any outgoing note don’t have the field “Total_amount” and a value you’ll get an error):
="**Total**" + " €" + sum(this.file.outlinks.Total_amount)
For c) I don’t know any unified solution.
This options are simple dataview queries. I’m not habilitated to use the ‘dataviewjs’ queries.
EDIT:
This is an odd solution…
| Col 1 | Col 2 |
| ------------------------ | --------------------------------------- |
| `=this.file.outlinks[0]` | `=this.file.outlinks[0].Total_amount` |
| `=this.file.outlinks[1]` | `=this.file.outlinks[1].Total_amount` |
| `=this.file.outlinks[2]` | `=this.file.outlinks[2].Total_amount` |
| `=this.file.outlinks[3]` | `=this.file.outlinks[3].Total_amount` |
| `=this.file.outlinks[4]` | `=this.file.outlinks[4].Total_amount` |
| `=this.file.outlinks[5]` | `=this.file.outlinks[5].Total_amount` |
| `=this.file.outlinks[6]` | `=this.file.outlinks[6].Total_amount` |
| `=this.file.outlinks[7]` | `=this.file.outlinks[7].Total_amount` |
| `=this.file.outlinks[8]` | `=this.file.outlinks[8].Total_amount` |
| **Total** | `=sum(this.file.outlinks.Total_amount)` |
EDIT 2
Maybe I had misinterpreted your example: “outgoing finances” ≠ “outgoing links”. My bad, english is not my language.
Well, with that difference, I can suggest this:
- A table with the list of the “Total_amount” by file
```dataview
TABLE Total_amount
FROM #finance
WHERE Total_amount
```
- For the total of all “Total_amount” in all the pages with the tag
#finance
, you can use this (but don’t ask me why, my javascript knowledge is equal to zero):
```dataviewjs
dv.paragraph(dv.pages("#finance")
.Total_amount.array().reduce((acc, val) => acc + val, 0))
```
- To join the two queries, you can create a md table and embed the blocks of the two previous queries:
| List | Total |
| ------------- | ------------- |
| ![[#^83260c]] | ![[#^826374]] |
* NOTES:
- to find the blocks inside the note you write ![[#^ and then select the blocks > for the first column the block of query 1 (list); for the second one the block of query 2 (total)