Hello,

How would I make the below solution work if my definition looked like this?

\define mymacro(index1:"{{!!title}}")


I can substitute a hardcoded string (the same as the title) for $index1$ 
from your suggestion, but if I specify index1 to be {{!!title}} it doesn't 
seem to work.

Thanks!

On Thursday, June 18, 2020 at 8:51:46 PM UTC-7, Mark S. wrote:
>
>
>
>
> You can't substitute the < > brackets in the middle of a string like that. 
> You can only substitute them inside a filter expression where a square 
> bracket would have occurred. But there is a trick to concatenating strings 
> in filters using the "addprefix" and "addsuffix" operators. So your filter 
> expression might look like this:
>
> "[[$:/.somewhere/]addsuffix<myvar>]"
>
> But there's a way you can skip "set" and "list" completely:
>
> \define mymacro(index1)
> <$tiddler tiddler={{{ 
> [[tiddler1]getindex[$index1$]addprefix[$:/.somewhere/]] }}}>
> {{||$:/.somewhere/templates/mytemplate}}
> </$tiddler>
> \end
>
> Remember to end your macro definitions with \end, BTW.
>
>
>
> On Thursday, June 18, 2020 at 8:12:12 PM UTC-7, The Islander wrote:
>>
>> Hi everyone,
>>
>> I can't seem to be able to figure out how to get this to work. Appreciate 
>> your help.
>>
>>
>>
>> \define mymacro(index1:"{{!!title}}")
>> <$set name="myvar" tiddler="tiddler1" index=$index1$>
>> <$list filter="[$:/.somewhere/<myvar>]">{{||$:/.somewhere/templates/
>> mytemplate}}</$list>
>> </$set>
>> \end
>>
>>
>>
>>
>> Can't seem to figure out what I'm doing wrong.
>>
>> 1. I need to get a value from a data tiddler (tiddler1) with an index 
>> equal to the title field of the invoking tiddler (named index1 = 
>> {{!!title}}).
>> 2. The result of first step = myvar.
>> 3. I need to take the result and get a tiddler named $:/.somewhere/<myvar>
>> 4. I need to display the resulting tiddler using a template named $:
>> /.somewhere/templates/mytemplate
>>
>> The results don't seem to work.
>>
>> Appreciate your help!
>>
>> Thanks.
>>
>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4294ec32-13de-4ba6-993a-586c2a9c87aao%40googlegroups.com.

Reply via email to