Display Formulas Inline

Use case or problem

Formulas allow to display large amount of information, but they are limited to Bases.
That makes it hard to build complex ideas for them, as they are limited in such way.
While it is possible to embed bases, it is not flexible enough.

I will mark that what i am asking is ability to display properties inline, rather then inline properties.

Proposed solution

Ability to use inline embed for formulas.
It would be easer with something like Global Formulas.
But formulas do work as strings so that fine too.

Current workaround

There are some plugins to display propertys inline, but no way to display formula equalent without certain about of JS.

1 Like

What is an example of how you would use this?

Lets say i have propery Rank, that is a number.

Using

html(
  "<span style='font-size:24px; color:" +
    if(Rank<=3, "#CD7F32",

        if(Rank<=6, "#C0C0C0",

            if(Rank<=9, "#FFD700",

                "#a570f5"
              )
            
          
        )
      
    ) +
  "'>" +
    if(Rank==Rank.floor(), 
      "✦".repeat((Rank-1) % 3 + 1) +
      "âś§".repeat(3 - ((Rank-1) % 3 + 1)),
      "âś§âś§âś§"
    ) +
  "</span>"
)

It can be displayed as ✦✧✧ (<span style="font-size: 24px; color:#a570f5">✦✧✧</span>)
instead.

And later in the note it can be refered in places related to the rank.
As well as used in a wiki style box or simular places. As i usually hide properties all together.

It can be also used to dynamicaly get stuff like character lifespan based on dates.

Some of it probably can be fixed by having a Fliped table view

But that is also not here.

I’d also love a feature like this. I’ve used bases to basically create a dynamic dnd character sheet. I’ve defined all my stats and abilities in the frontmatter and created loads of inline bases with just one line (filtering for file == this.file) where I use formulas to calculate various things (e.g.:spellsave: 8 + this.file.properties['proficiency'] + (this.file.properties[this.file.properties['spellcastingattribute'].lower()] / 2).floor() - 5).

I’m also using meta bind views to get values inside of text like `VIEW[{charisma} / 2 - 5]`.

If it was possible to use expressions from bases inline I would not need to use meta bind anymore. For the above example the base expression would be this.file.properties['charisma'] / 2 - 5 But I can’t get the value outside of an inline base.