Skip to content

Generate data using a button and display it #448

Closed Answered by 66BA9Q-ME49
66BA9Q-ME49 asked this question in Q&A
Discussion options

You must be logged in to vote

I've finally figured out how to store variables in-memory and display them.
For anyone who might struggle with this, the solution is to store properties using a memory bind target. The advantage of using this approach is that nothing is stored permanently in frontmatter making it convenient for non-persistent variables (like random numbers or calculations based on fields).

To assign or read the properties using JavaScript (inside buttons or meta-bind-js-view blocks), I use the following code:

// Get access to the Meta Bind API
const mb = engine.getPlugin('obsidian-meta-bind-plugin').api;
// Function to read a memory bind target
const getProperty = (name) => mb.getMetadata(mb.parseBindTarget(

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by 66BA9Q-ME49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant