On Thursday, March 5, 2020 at 3:14:37 AM UTC+3:30, TonyM wrote:
>
> Post Post script
>
> Below not tested, but believed correct
>
> Using variables in the called macro
> \define macroname() $(var1)$ $(var2)$ {{textreference}}
>
> <$set name=var1 value={{textref}} emptyValue="default">
> <$set name=var2 filter="[all[current]get[fieldname]]" emptyValue="default"
> >
> <<macroname>>
> </$set></$set>
>
>
> Also From TiddlyWiki <https://tiddlywiki.com/#Macros>
> A similar effect to a parameterised macro call can be produced by setting
> variables <https://tiddlywiki.com/#Variables> around a transclusion
> <https://tiddlywiki.com/#Transclusion>.
>
> Calling tiddler
> <$set name=var1 value={{textref}} emptyValue="default">
> <$set name=var2 filter="[all[current]get[fieldname]]" emptyValue="default">
> {{||templatetiddler}} <!-- note {|| which operated on the calling tiddler
> as currentTiddler -->
> </$set></$set>
>
>
> templatetiddler
> <<var1>>
> $(var1)$ <!-- not sure-->
> {{!!fieldname}} and other text references from calling tiddler
>
>
The $(var1)$ does not work except you put it inside a tiddler!
Eric Shulman has some good stuffs on these if you search TW-Scripts or this
forum.
> Note: A design pattern I use is to always make a macro operate on the
> currentTiddler, you can always use the tiddler widgety or a list to alter
> the currentTiddler variable to have a macro operate on a listed or other
> tiddler.
>
>
> If anyone can think of another method do share
>
> Regards
> Tony
>
>
> On Thursday, March 5, 2020 at 10:21:38 AM UTC+11, TonyM wrote:
>>
>> Post script
>>
>> If you want to construct your parameter the triple braces method is also
>> useful
>>
>> <$macrocall $name="select_tiddlers" timeStamp={{{ filter }}}/>
>>
>> <$macrocall $name="select_tiddlers" timeStamp={{{ [<variablename>] }}}/>
>> etc..
>>
>> But macros themself can access data in the tiddler calling it, or global
>> macros
>>
>> eg using $(variablename)$ in the macro.
>>
>>
>> Tony
>>
>> On Thursday, March 5, 2020 at 9:22:33 AM UTC+11, TonyM wrote:
>>>
>>> Vpl
>>>
>>> Even when we create our own macros using the \define you can use the
>>> macrocall widget instead of
>>> <<select_tiddlers timeStamp:'20200304175209359'>>
>>>
>>> <$macrocall $name="select_tiddlers" timeStamp='20200304175209359'/>
>>> <$macrocall $name="select_tiddlers"
>>> timeStamp={{tiddlername!!fieldname}}/>
>>> <$macrocall $name="select_tiddlers" timeStamp={{tiddlername}}/>
>>> <$macrocall $name="select_tiddlers" timeStamp={{!!fieldname}}/>
>>> <$macrocall $name="select_tiddlers" timeStamp=<<variableormacro>> />
>>>
>>> Regards
>>> Tony
>>>
>>>
>>> On Thursday, March 5, 2020 at 7:35:42 AM UTC+11, vpl wrote:
>>>>
>>>> Hi,
>>>>
>>>> I've developped a small macro but can't figure out how to pass it a
>>>> variable which is a field of another tiddler
>>>>
>>>> The following call works fine. I pass the value '20200304175209359' to
>>>> the macro which use it
>>>> <$list filter=<<select_tiddlers timeStamp:'20200304175209359'>>>
>>>> <$link /><br>
>>>>
>>>> But When I try to pass the value of the field timestamp from tiddler
>>>> ref-timeStamp, what is passed is the string
>>>> *{ref-timeStamp!!timestamp}*
>>>>
>>>> <$list filter=<<select_tiddlers
>>>> timeStamp:[[{ref-timeStamp!!timestamp}]]>>>
>>>> <$link /><br>
>>>> </$list>
>>>>
>>>> Any idea and help ...
>>>>
>>>> THanks a lot
>>>>
>>>> Regards
>>>>
>>>>
--
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/4e22c85d-0074-4aef-878d-435718e2b4a6%40googlegroups.com.