Transcluding results from one filter into another

Hi,

If I type ‘10’ in Tiddler 1, then this

<% if [{Tiddler1}compare:number:eq[10]then[true]] %>

evaluates to true.

But not if Tiddler 1 shows ‘10’ from {{{=5 =5 +[sum[]]}}}

So how do you transclude the value of a filter/expression from one tiddler into another filter?

I’ve looked all over and can’t find an answer which suggests I’m probably posing the wrong question - but at the same time it does seem to be something you’d want to do.

Thanks
Jon

You can use the $wikify widget to capture the rendered text output from a tiddler and store it in a variable, like this:

<$wikify name="output" text={{Tiddler1}}>
<% if [<output>compare:number:eq[10]then[true]] %>

Note that the $wikify widget should be used sparingly. See https://tiddlywiki.com/#Performance, which includes this caveat:

  • Where possible use the SetWidget or VarsWidget with filters instead of the WikifyWidget for declaring variables and string concatenation. The performance of the wikify mechanism is relatively poor as there is no opportunity to cache the parse tree or widget tree.

That having been said, as long as $wikify is not invoked lots of times (e.g., within a $list widget that processes many items), the performance issue may not be a problem.

-e

2 Likes

Thanks Eric, that works in my simple example so I’m sure it will work for the real issue and I’ll study those alternatives.

Thanks again
Jon