Islander

I presume you are calling this macro with 

<<mymacro>> and some times
<<mymacro "tiddlername">>

In your macro you can use $(currentTiddler)$ to access a value from where 
the macro was "called"
\define mymacro()
<$set name="myvar" tiddler="tiddler1" index="$(currentTiddler)$">
<$list filter="[$:/.somewhere/<myvar>]">{{||$:/.somewhere/templates/
mytemplate}}</$list>
</$set>
\end

However is the tiddler title a legitimate index?

Also you could do this to default to the current tiddler unless tiddlername 
is provided
\define mymacro(tiddlername)
<$set name=index-name value="$tiddlername$" emptyValue="$(currentTiddler)$">
<$set name="myvar" tiddler="tiddler1" index=<<index-name>> >
<$list filter="[$:/.somewhere/<myvar>]">{{||$:/.somewhere/templates/
mytemplate}}</$list>
</$set></$set>
\end

However I will add that it can depend on how you call the macro. The most 
guaranteed way is with the macrocall widget, that allows you a wider range 
of parameter sources

<$macrocall $name=mymacro index1={{!!title}} />
<$macrocall $name=mymacro tiddlername=<<avarwithtiddlername>>/>

Id did not have the setup to test the above.

Regards
Tony

On Friday, June 19, 2020 at 1:12:12 PM UTC+10, 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>
>
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/781a8ae6-7942-4507-9ed5-fd0f07389dbbo%40googlegroups.com.

Reply via email to