Dataview and live preview

I want to calculate and show the time I slept in my daily notes. To do this I write down the time I fell asleep and when I woke up.

Asleep:: 2022-04-15T22:35
Awake:: 2022-04-16T07:15

Then I use the following code to calculate the time slept:

Slept = this.Awake - this.Asleep

In reading mode this will calculate and show the time slept. But it is not showing in Live Preview mode.

Doesn’t Dataview support Live Preview for formulas? Or perhaps you have a better way of doing this that you could recommend.

Thanks in advance!

4 Likes

Any updates on this?

The question is: inline queries don’t “run” in Live preview, only in Reading view.

1 Like

I’m wondering, as well, as to why, when using the Editing pane–view with the Live Preview editing mode enabled, inline dataviews fail to render live previews of their output.

I’ve been using Obsidian for five days and, in that time, I hadn’t switched from the Editing pane–view to the Reading pane-view once until today when I finally figured out that that’s what I have to do to see inline dataviews rendered —I didn’t even know Reading pane-view existed. All the other plugins I’ve been using render in the Editing pane-view with Live Preview editing mode enabled. I spent a bunch of yesterday and the day before thinking Dataview just didn’t work and trying to troubleshoot it: I disable every other plugin, eventually completely reinstalled Obsidian, and spent a bunch of time googling.

That inline dataviews don’t render their results in the Live Preview editing mode was really intuitive to me. And, yes, I get now that I can just switch to the Reading pane view, but I don’t want to have to toggle back and forth; it’s annoying.

I just noticed that an inline dataview works just fine with the Live Preview edit mode when placed with a callout.

E.g., this gets rendered as expected…

> [!question]
> `= this.file.name`

but the following does not

`= this.file.name`
7 Likes

The formula is working for me now in Live Preview, so the question is no longer relevant.

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