Using a variable set from a transclusion in a macro, in a widget...

50 views
Skip to first unread message

David Szego

unread,
Feb 8, 2017, 6:02:32 PM2/8/17
to TiddlyWikiDev
I seem to be asking the same question all the time! ;->

Tiddler 1:

\define myName() {{$:/status/UserName}}
\define myCreated() <$view tiddler=$(myName)$ field="created" format="text"/>

MyName: <<myName>> (shows DavidSzego)

MyCreated: <<myCreated>> (shows datestamp)

Tiddler 2:

List (should return back the Tiddler with my name):

<$list filter="[field:created<myCreated>]">
<
<currentTiddler>>
</$list>

<$button>Click<$action-widget message="whatever" field=<
<myCreated>> /></$button>

When I call <<myCreated>> directly, I get the date stamp.

When I call it from a macro *or* a widget, the best I can get is "true"!

But more often, I get some kind of quoting error (changes depending on the single/double/none quotes I use in the "<$view>" widget above), where a button will generate something like 

[Click />]

where <$button...> is including the closing /> from the <$action-widget ...

Any hints on how to call these properly?

Thanks! =-)

BJ

unread,
Feb 9, 2017, 4:05:52 AM2/9/17
to TiddlyWikiDev
macros (except js ones) are a type of template, use <$text text=<<myVariable>>/>
to see the result of you variables when used as attributes.

try instead
<$set name="myVariable" filter="[field:title{$:/status/UserName}get[created]]">
<$button>Click<$action-sendmessage message="whatever" field=<
<myVariable>> /></$button></$set>

all the best
BJ

David Szego

unread,
Feb 9, 2017, 1:51:40 PM2/9/17
to TiddlyWikiDev
Thanks, will give it a try... <$view and <$transclude didn't help! =-)

David Szego

unread,
Feb 9, 2017, 3:12:23 PM2/9/17
to TiddlyWikiDev
Wow. Is that ever elegant. Thanks!
Reply all
Reply to author
Forward
0 new messages