Page
https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/viewfields/math/
Issue or Enhancement
While I have referenced the Math View page, I think that there needs to be probably another page under the button pages that also explains and provides some examples of how mathjs works with meta-bind.
First with some experimenting I was able to get a View to use mathjs correctly. Somewhere I found a reference to using a math namespace for mathjs functions. Yes, the mathjs pages specifically use this namespace but I thought I found a reference that was Obsidian specific (possibly using the meta-bind plugin) that used math, Math or mathjs. I can not find the reference now. It may also have been an AI hallucination. In any event, I tried the following with error of the namespace not being defined in JavaScript.
`VIEW[math.pickRandom\["Option A", "Option B", "Option C"\])]`
`VIEW[Math.pickRandom\["Option A", "Option B", "Option C"\])]`
`VIEW[mathjs.pickRandom\["Option A", "Option B", "Option C"\])]`
Finally trying without a namespace worked within the View.
`VIEW[pickRandom(\["Option A", "Option B", "Option C"\])]`
So I would request that the View Math page be updated with a couple of examples that show calling mathjs functions so that others do not run into the same problems and get frustrated.
What really triggered this divergence of being productive was that I have a Button that I built a while back and thought it was working at that time. Now I get failures in the console. That Button is defined as follows:
```meta-bind-button
style: default
label: Initialize test parameters
icon: test-tube-diagonal
id: initialize-testing
action:
type: updateMetadata
bindTarget: dev_test_years
evaluate: true
value: mathjs.pickRandom("2007-2008,2008-2009,2009-2010,2010-2011,2011-2012,2012-2013,2013-2014,2014-2015,2015-2016,2016-2017,2017-2018,2018-2019,2019-2020,2020-2021,2021-2022,2022-2023".split(","))
I think it would be worth a couple mins of time to create a new page on how to access the mathjs functions in a Button context.
Also, I found a reference to creating a Button using the InlineJS action and experimented with this also, but I had the same problem of not being able to access the the mathjs namespace.
Page
https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/viewfields/math/
Issue or Enhancement
While I have referenced the Math View page, I think that there needs to be probably another page under the button pages that also explains and provides some examples of how
mathjsworks withmeta-bind.First with some experimenting I was able to get a View to use
mathjscorrectly. Somewhere I found a reference to using amathnamespace formathjsfunctions. Yes, themathjspages specifically use this namespace but I thought I found a reference that was Obsidian specific (possibly using themeta-bindplugin) that usedmath,Mathormathjs. I can not find the reference now. It may also have been an AI hallucination. In any event, I tried the following with error of the namespace not being defined in JavaScript.Finally trying without a namespace worked within the View.
So I would request that the View Math page be updated with a couple of examples that show calling
mathjsfunctions so that others do not run into the same problems and get frustrated.What really triggered this divergence of being productive was that I have a Button that I built a while back and thought it was working at that time. Now I get failures in the console. That Button is defined as follows:
I think it would be worth a couple mins of time to create a new page on how to access the
mathjsfunctions in a Button context.Also, I found a reference to creating a Button using the InlineJS action and experimented with this also, but I had the same problem of not being able to access the the
mathjsnamespace.