← [[Automated Notes|Intro]] ⦿ [[Prerequisites]] ⦿ [[Create a daily note|Create]] ⦿ [[Daily note with Time Tracking|Track]] ⦿ [[Weekly Notes|Weekly]] ⦿ [[Dynamic content|Dynamic]] ⦿ [[Reports|Reports]] ⦿ Samples → ## Dynamic content Enabling Dataview allows you to have dynamic, data-derived content in your notes. ### Config Enable Dataview in the Community plugins, then ![[settings.svg#icon]] in Dataview settings, and enable the first 5 settings: ![[Dataview Settings.png]] Add this line to any Daily note: ``` [Hours:: `=round(dur(date(choice(this.end_time, this.end_time, dateformat(date(now),"HH:mm")),"HH:mm")-date(choice(this.start_time, this.start_time, dateformat(date(now),"HH:mm")),"HH:mm")).hours - this.breaks, 1)`] [Breaks:: `=this.breaks`] [Hol:: `=this.holiday`] [Vac:: `=this.vacation`] ``` You'll now see a summary of the day's hours, breaks, holiday, and vacation. ![[Hour summary.png|300]] To get this into the daily notes, add it to `Templates/daily.md` between the first header and the forward/back nav. Now whenever you create a new Daily note, you'll get the hours summary! >[!info] Pro-Tip™️ Sometimes the content of the note will be processed by Dataview before the note is done populating, and you'll see something like this: ![[Race condition.png]] In that case, just navigate back and forward and the formulas will get reëvaluated. ## Showing properties inline Sometimes you'll want to echo a property in your note without interrupting the flow of text, and for that the Dataview inline js query is the trick. Assuming you've followed the steps so far, a typical Daily note will have these properties: ![[Daily properties.png]] So if you wanted to mention your `holiday` for today, use the Dataview inline DQL format, e.g.: ```text I took `=this.holiday` hours of holiday today. ``` Which would render as "I took 4 hours of holiday today." For more complicated queries you could get fancier with Dataview's inline .js syntax, e.g.: ```text I took `$=if(dv.current().breaks != 0) { dv.span(dv.current().breaks.toFixed(1) + ' hours'); } else { "no" }` holiday today. ``` → "I took 4.0 hours holiday today." → Or "I took no holiday today." if `holiday` property was 0. Lots more examples and documentation at [Dataview docs](https://blacksmithgu.github.io/obsidian-dataview/queries/dql-js-inline/). ← [[Weekly Notes]] ⦿ [[Reports]] →