I had a trial run of using TW's built-in math operators, hoping they could allow the result to be evaluated in a variable, but it didn't work. It's the same issue - even when it's a negative value, sign[] interprets it as a positive. Probably because it's coercing the wikitext string to a number, instead of using the number from the result?
Here's a sandbox to replicate that: https://trumad.github.io/budgetlywiki/budgetDeltaRedNative.html On Tuesday, 11 May 2021 at 10:16:46 UTC+1 [email protected] wrote: > Oh silly me. That's fixed now, and it works as expected when the > {{budgetDelta}} tiddler has j*ust a number* in it. As soon as I put in > the formulas plugin syntax *(= {{Income Total}} - {{Expenses Total}} =)* > it breaks. Maybe I need to find a way to do all the math using TW native > functions instead. Because it seems that the variable is not stored as the > numeric result of the formulas sum() function, but as the function call > itself. > > I uploaded a better test version of the site where you can play around > with everything yourself, if someone has the time to take a look.. > https://trumad.github.io/budgetlywiki/budgetDeltaRed.html - I have not > added the CSS definitions yet, but you can see in the DOM that the class > name remains black. (Unless you overwrite {{budgetDelta}} with a negative > integer). > > Maybe there is a whole different way of achieving all this than I am > currently aware of. Thanks so much for your help so far. > > On Tuesday, 11 May 2021 at 07:45:40 UTC+1 Eric Shulman wrote: > >> On Monday, May 10, 2021 at 11:31:07 PM UTC-7 [email protected] wrote: >> >>> Ok, this might get me somewhere. I did some testing like so, but the >>> classname is always black: >>> <$set name=number value=-5> >>> <$set name=cssclassname >>> filter="[<<number>>sign[]match[-1]then[red-bold]else[black]]"> >>> <span class=<<cssclassname>>><<number>></span> >>> </$set> >>> </$set> >>> >> >> Use *single angle brackets for variable references in filters.* >> >> Thus: >> <$set name=cssclassname filter="[*<number>* >> sign[]match[-1]then[red-bold]else[black]]"> >> >> -e >> > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/c1baed41-ded8-49bd-b52c-f6bb47281584n%40googlegroups.com.

