Display the value of a variable (defined in frontmatter or elsewhere)

Hello,

Things I have tried

I have a simple question that I cannot find an answer to. I’ve searched in the forum and in the documentation of Obsidian and in its dataview plugin.

What I’m trying to do

I would like to display the value of a variable that I defined in the frontmatter. I don’t want to create a list or a table, simply display it in the text.
I’ve tried all kind of synthax, but it doesn’t work.

Here is an example of what I would like to do:

Definition of the variable in the Front Matter:

---
testsw134p1u: 2
---

Different way to refer on it I’ve tried, but they don’t work:

{testsw134p1u}
{testsw134p1u.value}
this.testsw134p1u.value

Thank you for your help!

If you are using Dataview, then to display a simple value defined in YAML you would use:

`= this.testsw134p1u`
1 Like

There’s a related feature request here.

Thank you for your answer. At the moment it doesn’t work yet. I have Dataview plugin installed, activated. Did I forget something?

Thank you for the hint. I tried the suggested syntaxes, but no luck, and both plugins are activated. I’ll write under the other post in case others have had similar problems.

About dataview syntax…

`=this.testsw134p1u`

This is the right expression for an inline query in the same note: the value of testsw134p1u in “this” note.

Basic questions:

  • in dataview settings (Settings > Dataview) the inline query prefix defined is “=”?
  • are you talking about the output in Live Preview? AFAIK inline queries doesn’t work in Live Preview mode… Only reading mode!

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