To define a dataview field, you need to do one of these:
---
fieldA: myValueA
---
fieldB:: myValueB
Doing just #log/dailyQuestions/stress_level: 5
in the body text doesn’t define a dataview field, and can as such not be read from neither a dataview query, nor the tracker plugin.
So doing the following:
#log/dailyQuestions/stress_level:: 5
`$= dv.span( dv.current() ) `
In a file, reveals that the following are true:
- It does make the #log/dailyQuestions/stress_level into a tag, as seen in both
file.etags
and file.tags
- It creates a dataview field named:
log/dailyQuestions/stress_level
with a value of 5
- It normalises and created a dataview field named:
logdailyquestionsstress_level
with a value of 5
Accessed from dataviewjs
Further more, if we try to access this as from a dataviewjs query:
with slashes as object field: `$= dv.span( dv.current().log/dailyQuestions/stress_level ) `
with slashes as reference: `$= dv.span( dv.current()["log/dailyQuestions/stress_level"] ) `
normalised: `$= dv.span( dv.current().logdailyquestionsstress_level ) `
we get the output:
Notice how the first variant doesn’t work since it contains slashes, and they are not very good to include in a field name.
Accessed from a DQL query
However, you used a DQL query in your original post, and then either of these incantations would work to get the value of it:
```dataview
TABLE row["log/dailyQuestions/stress_level"], logdailyquestionsstress_level, stress_level_comment
TABLE
log/dailyQuestions/stress_level,
stress_level_comment
FROM "Daily notes"
SORT file.name DESC
```
NB! I simplified the query here, but do use your original query just correct with the new variant to get the actual field value.
So I guess that if you want to use it with the Tracker plugin, you probably should use the logdailyquestionsstress_level
variant, and in a DQL query, you could use either. I tend to see the row["..."]
variant as slightly more readable. (And even better would be to use a better field name without the slashes)
In summary, to make it a proper field in the body of your note you need to use two colons. And then to refer to it you need either to use the normalised variant, logdailyquestionsstress_level
, or the row["log/dailyQuestions/stress_level"]
to get the value of it. And I reckon you’ll need to use the first variant within Tracker definitions.