apply macro to outer tiddler of transcluded pair?

29 views
Skip to first unread message

Dave

unread,
Mar 20, 2017, 11:47:46 PM3/20/17
to TiddlyWiki

Sorry if this is complicated (seems that way to me), but I have a question about using macros in remote tiddlers that are transcluded to change field content locally. 


There are three layers: the macro tiddler, the test tiddler which calls upon the macro, and the date tiddler that want's to record the test, but uniquely in today's tiddler.

Lets say I have a tiddler just named as today's date: [[2017-03-20]]


In it I have this transclusion: {{Lumbar Kemps}} which has this content:

<<s.test "Lumbar Kemps" left>>

which refers to this macro pair in another macro tiddler tagged with $:/tags/Macro

\define s.test.result(mytestname,myresult)
<$transclude tiddler="$mytestname$ Dxs" index="$myresult$"/>
\end

\define s.test(testname,testfield)
<$select tiddler="""$(currentTiddler)$""" field="""$testname$-$testfield$""">
<$list filter="[list[testDictionary##$testname$]]"><!-- gets the list of options for this test-->
<option value=<<currentTiddler>>><$text text=<<currentTiddler>>/></option>
</$list>
</
$select>
<$set name="result" value={{$(currentTiddler)$!!$testname$-$testfield$}}>
<$macrocall $name=s.test.result myresult=<<result>> mytestname="$testname$" />
</$set>
\end

What I want to happen is for the $(currentTiddler)$ in the select widget to be "2017-3-20", not "Lumbar Kemps", but that's not what's happening (the results are being recorded in [[Lumbar Kemps]]).

Is there a way to make this work the way I want it to?


Thanks,

- Dave

Eric Shulman

unread,
Mar 21, 2017, 12:34:50 AM3/21/17
to TiddlyWiki
On Monday, March 20, 2017 at 8:47:46 PM UTC-7, Dave wrote:

Sorry if this is complicated (seems that way to me), but I have a question about using macros in remote tiddlers that are transcluded to change field content locally. 

... 

In it I have this transclusion: {{Lumbar Kemps}} which has this content:

<<s.test "Lumbar Kemps" left>>

What I want to happen is for the $(currentTiddler)$ in the select widget to be "2017-3-20", not "Lumbar Kemps", but that's not what's happening (the results are being recorded in [[Lumbar Kemps]]).  Is there a way to make this work the way I want it to?


Instead of {{TiddlerName}}, use {{||TiddlerName}}.  This will apply the indicated tiddler as a *template* for the values from the current tiddler and leaves the value of $(currentTiddler)$ unchanged when the template is transcluded (i.e., it will remain [[2017-03-20]], rather being set to [[Lumbar Kemps]])


enjoy,
-e

Dave

unread,
Mar 21, 2017, 2:06:30 AM3/21/17
to TiddlyWiki
Thank you sir!
Reply all
Reply to author
Forward
0 new messages