In a similar vein to V5.4.0 prerelease - Clearifications about MVVs using with various operators… I thought I’d start a new conversation for post-5.4.0 possibilities.
As an avid user of +[format:titlelist[]join[ ]] + enlist<var> constructions, I’ve been excited about the potential of multi-valued variables since they were first teased, and this week I’ve finally found some time to start converting a lot of my old functions, filters, and $let assignments to use the new syntax. This has enabled me to convert a lot of code like this…
\function concepts() [tag[Concepts]] +[format:titlelist[]join[ ]]
<$let variables={{{ [tag[Variables]] +[format:titlelist[]join[ ]] }}}>
{{{ [enlist<concepts>] [enlist<variables>] }}}
into the following simpler alternatives:
\function concepts() [tag[Concepts]]
<$let variables={{{ [tag[Variables]] }}}>
{{{ [(concepts)] [(variables)] }}}
Which is great! Except that I keep running into instances like this…
<$let variables={{{ [tag[Variables]] +[format:titlelist[]join[ ]] }}}>
{{{ [[A]match[A]then<variables>enlist-input[]] }}}
At present, the only filter operators that accept MVVs as parameters (as per the documentation) are title and function. This means that in a scenario like the one above, I can’t actually redefine <<variables>> as an MVV, because I can’t replace <variables>enlist-input[] with (variables). then doesn’t support MVVs, so then(variables) will return only the first title in the list, not the entire list I need.
In this very simplified example, I can replace then with :then as a workaround:
<$let variables={{{ [tag[Variables]] }}}>
{{{ [[A]match[A]] :then[(variables)] }}}
But this isn’t always a viable solution, especially in more complex multi-run filters.
This leads me to a question for our devs: Is it possible to extend additional filter operators to accommodate MVV parameters?
And a discussion question for other users: Which other filter operators would you like to use with MVVs?
My personal wishlist:
then, as discussed above- other operators that can take space-separated lists, like
fields:exclude/fields:includeorsearch::words(where each value in the MVV would constitute a “word” — I expanded on this in a later post) - perhaps
containscould be similarly extended so thatcontains:tags(var)would return tiddlers containing all the MVV values in theirtagfield?