Invoking Meta Bind's context.file.path property from Data View JS

What I’m trying to do

Hi Obsidian Community - first time poster.

I’ve developed a note that uses a combination of Meta Bind and Data View to get and set the note’s properties. All of that is working great. The note is beautiful and Meta Bind and Data View are both amazing and I did buy both them guys a nice cup of coffee.

My question is really about js-engine and dataviewjs and when those code blocks are invoked. DataviewJS is happly running in the background, doing what it needs to do, not looking for any interaction with me.

js-engine is different. js-engine wants me to be involved. Flipping between View and Edit modes, scrolling through the block of code and bloop, then it does what it needs to do.

I want js-engine to behave more like dataviewjs. As a total Obsidian newbie, I thought, “Simple just change js-engine to dataviewjs at the top of the script block!”

Almost. It almost works, but it balks on the syntax for the context.file.path in the parseBindTarget() function.

Things I have tried

I’ve googled around, searched the topics here and it does seem like you can invoke Meta Bind from DataviewJS, so I’m here looking for your help.

I think I have two possible options.

  1. Get the DataviewJS syntax for the parseBindTarget() function - does anyone know how to change this line of code to be compatible with DataviewJS?

const bindTheName = metaBindApi.parseBindTarget(‘MyProperty’, context.file.path); // remember all the code around this works with just fine with js-engine.

  1. Just make js-engine behave like DataviewJS - I’ve tried adding a “;” to the end of the code block, but that didn’t seem to do anything.

Thanks in advance for your help!

Tom

Resolved!

This dataviewjs code works! Meta Bind and Data View peacefully coexisting!

const CurrentFile = dv.current();
const bindTheProperty = metaBindApi.parseBindTarget('MyProperty', CurrentFile.file.path);