Closed Kobus-Smit closed 4 months ago
You should certainly be able to transform this expression via navigation plugin. I don't think there is any recommendation around that, except try not to go too wild with this expressions as it complicates dealing with tags. But something like
[[CPC:is(N):and(DCC=Y)]:showIfTrue]
and
[[MOTO:or(Manual)]:showIfTrue]
where you convert this navigation to true/false (or some equivalent)
What some people already do when using Templater is do a pre-processing step and convert this human friendly tags/expressions into Templater friendly tags. That would not work nicely with Templater Editor, as it does not support this pre-processing step. My recommendation is to always try and expand data set with more fields rather than try to handle it via tags, as that often grows to unreadable mess rather soon.
Thanks for the reply @zapov
The navigation plugin worked fine. Ended up with this:
[[CPC:is(N):and(DCC):is(Y)]:showIf(Y)]
[[MOTO:or(Manual)]:showIf(Y)]
Would have been nicer if this worked:
[[CPC:isNo:and(DCC)]:showIfYes]
[[MOTO:or(Manual)]:showIfYes]
(I'm using Yes
and No
because that is how our data looks and our business users are used to that)
But it does not work because metadata
is then parsed as isNo:and(DCC)]
.
It works if I add brackets, and will probably use that, although it is cleaner without the brackets
[[CPC:isNo():and(DCC)]:showIfYes]
When configuring navigation plugin, second argument is parser for expressions. You can provide your own parser there and then you will be able to specify it without parenthesis: https://templater.info/apidocs/hr/ngs/templater/DocumentFactoryBuilder.NavigationEnd.html
Thanks for that, problem solved!
Hi @zapov
We have a custom
showIf
plugin based on your collapseIf example, for example:[[CPC]:showIf(Y)]row with CPC data
Users now want to show/collapse according to multiple tags, sometimes with AND and sometimes with OR.
Our current workaround is to create a combined new column in the source data, for example:
[[CPC is N AND DCC is Y]:showIf(Y)]
[[MOTO OR Manual]:showIf(Y)]
But they users cannot always extend the source data, so I want to write a custom plugin to handle it.
What would your recommendations be on how to best implement this?
Thanks, Kobus