Passing macro parameter to a list widget

237 views
Skip to first unread message

passingby

unread,
Jan 29, 2018, 2:41:47 PM1/29/18
to TiddlyWiki
How do i pass a parameter value coming in into a macro definition, to a list widget filter.

this does not seem to work for me:


\define contactevents(name)


<$list filter="[tag[event]search:people[$name$]]">


</$list>
\end


I also tried with search:people[<name>] and search:people <name>

If I hard code the value then it works eg search:people[John]

Which means that the filter expression and the macro is working. I am only making a mistake in passing the parameter value.

Mark S.

unread,
Jan 29, 2018, 2:57:39 PM1/29/18
to TiddlyWiki

That worked for me when invoked like:

<<contactevents "John">>

Good luck,

-- Mark

passingby

unread,
Jan 29, 2018, 3:45:16 PM1/29/18
to TiddlyWiki


On Monday, January 29, 2018 at 12:57:39 PM UTC-7, Mark S. wrote:

That worked for me when invoked like:

<<contactevents "John">>

Good luck,

-- Mark

hm..true. Its working that way. The thing is I am making the call from inside a template. I am not sure why it works from outside a template , in a regular tiddler and not in a template. If i write $name$ in the macro outside the listwidget it displays the parameter value, which shows that at least the parameter is being passed through. Strange.

passingby

unread,
Jan 29, 2018, 3:48:52 PM1/29/18
to TiddlyWiki
In any case I got it working like this:

\define contactevents(name)

<$set name="item" value=$name$>
Figured in the field 'people' of: 
<$list filter="[tag[event]search:people<item>]">

</$list>
</$set>
\end


Mark S.

unread,
Jan 29, 2018, 4:22:55 PM1/29/18
to TiddlyWiki
It might help to see how you are/were calling it from the template.

-- Mark

coda coder

unread,
Jan 29, 2018, 4:46:26 PM1/29/18
to TiddlyWiki

<$set name="item" value=$name$>


I had the exact same problem and solved it exactly like that.  It was a while ago... can't find it now. :/



passingby

unread,
Jan 30, 2018, 12:19:44 AM1/30/18
to TiddlyWiki


On Monday, January 29, 2018 at 2:22:55 PM UTC-7, Mark S. wrote:
It might help to see how you are/were calling it from the template.

-- Mark

 
Apologies for replying late. I have attached a test file with this. The template which calls the macro is $:/my/templates/ContactFooter
test.html

Mark S.

unread,
Jan 30, 2018, 10:18:14 AM1/30/18
to TiddlyWiki
Unfortunately, this syntax won't work anywhere:

<<contactevents {{!!title}}>>

What you can do instead is call with the macro widget:

<$macrocall $name="contactevents" name={{!!title}}/>

The {{!!title}} transclusion syntax only becomes a "real", passable entity when used in a widget with a "=". That's the best I can explain it at the moment.

Good luck!

-- Mark

passingby

unread,
Jan 30, 2018, 11:58:56 AM1/30/18
to TiddlyWiki


On Tuesday, January 30, 2018 at 8:18:14 AM UTC-7, Mark S. wrote:
Unfortunately, this syntax won't work anywhere:

<<contactevents {{!!title}}>>

What you can do instead is call with the macro widget:

<$macrocall $name="contactevents" name={{!!title}}/>

The {{!!title}} transclusion syntax only becomes a "real", passable entity when used in a widget with a "=". That's the best I can explain it at the moment.

Good luck!

-- Mark

I see. I thought since I could retrieve and display in the macro the value being passed , that it was working ok. But surely something is the issue here with this syntax. 

Thank you for looking at this Mark.
Reply all
Reply to author
Forward
0 new messages