[tw5] LetWidget with filter attribute value that has spaces

So, given the following LetWidget example:

<$let n={{{ [[foo]][[bar]] }}}></$let>

Since that filter returns a list of tiddlers, I would get n=foo and bar gets assigned as its own attribute (pretty sure).

I am using a SetWidget to solve my problem, but wondering if there is some way of enclosing a let attribute value such that a filter result containing spaces is preserved in whole.

Thanks for reading!

Try this

<$set name=n filter=" [[foo]][[bar]]">

{{{ [enlist<n>] }}}

<<n>>

</$set>

That’s a better example

<$set name=n filter=" [[foo]][[bar bas]]">

{{{ [enlist<n>] }}}

<$text text=<<n>>/>

</$set>

Thank you. I did solve it already with a SetWidget. I was hoping for a solution that would use the LetWidget as is.
Essentially I am wondering if the LetWidget is limited to filter results with only one returned title.

Essentially I am wondering if the LetWidget is limited to filter results with only one returned title.
Or if there is something that I could learn about writing the expressions or how to quote it. There is always a new way to skin a cat in tiddlywiki! :D!

Thank you. I did solve it already with a SetWidget. I was hoping for a solution that would use the LetWidget as is.

If {{{xx}}} is used and there are several results it will always only apply the first result. That’s by design.

So the following code will all have the same result: n=foo

<$let n={{{ [[foo]][[bar]] }}}>
<<n>>
</$let>

<$vars n={{{ [[foo]][[bar]] }}}>
<<n>>
</$vars>

<$set name=n value={{{ [[foo]][[bar]] }}}>
<<n>>
</$set>

Essentially I am wondering if the LetWidget is limited to filter results with only one returned title.

No. As written above it’s how {{{…filter…}}} is resolved. It doesn’t matter which widget you use. You have to use the <$set name=n filter="..." or <$list filter="...", to get several results.

-mario

Thank you so much for your help, Mario! This conversation did kick a cog into gear in my head and I realized that the filtered transclusion was returning a list and that is distinct from a string with spaces. so I added a +[join[ ]] to my expression and that got me the result I wanted.

Which, for the use case where I first encountered this, that actually worked perfectly.

<$let n={{{ [[foo]][[bar]] }}}>
<<n>>
</$let>
<!-- foo -->

<$let n={{{ [[foo]][[bar]] +[join[ ]] }}}>
<<n>>
</$let>
<!-- foo bar -->

Thank you so much for your help, Mario!

You are welcome!

This conversation did kick a cog into gear in my head and I realized that the filtered transclusion was returning a list and that is distinct from a string with spaces. so I added a +[join[ ]] to my expression and that got me the result I wanted.

You are right. I could have thought about this myself … :wink:

Thanks for sharing your solution, so others may find it in the future.
-mario

You might also want to throw in a format:titlelist[] just before the join[ ] if you want to get the titles back later on.

Télumire,

I don’t need it now, no. But super useful to know for the instances where I will need it. Thank you!