Frontmatter nested values and dataview

I have a “TotalTasks” and “TasksCompleted” in my frontmatter and used it to calculate the overall progress but I don’t really like how these fields are named so followed the example here

image

However, I can’t retrieve the values from these nested field at all. In the example below, for the first tale, I used the usual “TotalTasks” and “TasksCompleted” while in the second one, I used “Tasks.Completed” and “Tasks.Total”. The code I have is

TABLE Tasks.Total, Tasks.Completed, ("<progress value="+((Tasks.Completed/Tasks.Total))+" max=1></progress> "+ round((Tasks.Completed/Tasks.Total)*100)+"%") AS Progress
FROM "Test"

What did I do wrong? I tried create the nested field like in the sample document but couldn’t even get the first table display so I added the dash “-”

If you use:

---
Tasks:
  - Total: 10
  - Completed: 5
---

then each element is an array (because the “-”) and something like Tasks.Completed/Tasks.Total works with single values, not an array of values.

But if you use

---
Tasks:
  Total: 10
  Completed: 5
---

then it works. (you need to use two spaces before each field, not an indent)

3 Likes

omg yes it works! Thank you so much :heart: Didn’t realise space and indentation can make such a difference

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.