List macro says: No result, where Advanced Search finds tiddlers

64 views
Skip to first unread message

Chris Brouwer

unread,
Jan 25, 2019, 8:53:20 AM1/25/19
to TiddlyWiki
Hello all,

I am trying to produce a list of tiddlers, filtered based on 1 tag and the contents of 1 field, inside a macro.

For debugging purposes I output the separate parts, as well as the constructed filter.

Everything looks as I expect it. But the macro still comes up with an empty list.

So ofcourse I tried the exact same filter in Advanced Search (Copy/Paste from the debugging output), and this time I do get the results I want, not an empty list.

Why is TiddlyWIki list widget giving me a different result ?

I have tested with a combination of 2 tags, with and without spaces, but the results are consistent.

Any thoughts ?

Ton Gerner

unread,
Jan 25, 2019, 9:13:05 AM1/25/19
to TiddlyWiki
Hi Chris,

May be this helps.

Cheers,

Ton


Chris Brouwer

unread,
Jan 25, 2019, 9:29:06 AM1/25/19
to TiddlyWiki
Hello Ton,

allthough this is enlightening for me, the situation is a bit more complex.

I am trying to adapt a little bit of Mario Pietsch's excellent work, just to include 1 extra filtering parameter.

Here is (most of) the code I changed:

\define createTripFilter(tag:"" trip:"" prefix:"")
[tag[$tag$]trip[$trip$]sort[title]]
\end

\define list-body(tag:"" trip:"" prefix:"")
--<br>
"""$tag$"""<br>
"""$trip$"""<br>
<<createTripFilter tag:"""$tag$""" trip:[[$trip$]] prefix:"">><br>
--<br>
<div class="table view-ovn-grid">
<span class="header">Naam</span>
<span class="header">Keuze</span>
<span class="header">Prijs</span>
<span class="header">Periode</span>

<$list filter=<<createTripFilter tag:"""$tag$""" trip:[[$trip$]] prefix:"">> emptyMessage="Niets gevonden">
<span class="box"><<getLink>></span>
<span class="box"><<getDescription>></span>
<span class="box"><<getPrijs>></span>
<span class="box"><<getPeriode>></span>
</$list>
</div>
\end

<<list-body tag:"Overnachting" trip:"{{$:/vak/curTrip}}" >>


I am using Tiddlywiki 5.1.19.

The tiddlers I am looking for contain the tag "Overnachting", and the name of the trip in the field "trip".



Op vrijdag 25 januari 2019 15:13:05 UTC+1 schreef Ton Gerner:

Mark S.

unread,
Jan 25, 2019, 10:18:03 AM1/25/19
to TiddlyWiki
It would take a half hour to set up data to give an exact fix, but what stands out immediately is that you are inserting wikitext into wiki text, which doesn't work:

Here

<<createTripFilter tag:"""$tag$""" trip:[[$trip$]] prefix:"">><br>

Hier

<$list filter=<<createTripFilter tag:"""$tag$""" trip:[[$trip$]] prefix:"">> emptyMessage="Niets gevonden">

<<list-body tag:"Overnachting" trip:"{{$:/vak/curTrip}}" >>

I think what you want is to make changes like:

<<createTripFilter tag:"""$tag$""" trip:"""$trip$""" prefix:"">><br>
...
<$list filter=<<createTripFilter tag:"""$tag$""" trip:"""$trip$""" prefix:"">> emptyMessage="Niets gevonden">

And invoke the macro with a macro call:

<$macrocall $name=list-body tag="Overnachting" trip={{$:/vak/curTrip}} />

If you share a page as well, it wold be easier to tell if the syntax was right, but I think that's what you need.

Good luck
-- Mark

Chris Brouwer

unread,
Jan 25, 2019, 11:48:05 AM1/25/19
to TiddlyWiki
Hello Mark,

I already tried that construct, with the same result.

I add the tiddler here, and a screenshot of the output.

Still, with my version of the code, this is the filter it shows: **[tag[Overnachting]trip[Balkan 2019]sort[title]]** (Without the '**', of course ;-) )
So that looks like it does work (construct the correct filter, I mean). When I feed that to Advanced Search,, it gives me the expected reults. The <$list> does not.

Op vrijdag 25 januari 2019 16:18:03 UTC+1 schreef Mark S.:
$__vak_overnachting-list-template.tid
screenshot.png

Mark S.

unread,
Jan 25, 2019, 12:33:10 PM1/25/19
to TiddlyWiki
I tested, and this works. I assumed that tiddler $:/vak/curTrip contains the name of a trip:


\define list-body(tag:"" trip:"" prefix:"")
--<br>
"""$tag$"""<br>
"""$trip$"""<br>
<<createTripFilter tag:"""$tag$""" trip:"""$trip$""" prefix:"">><br>
--<br>
<div class="table view-ovn-grid">
<span class="header">Naam</span>
<span class="header">Keuze</
span>
<span class="header">Prijs</span>
<span class="header">Periode</
span>

<$list filter=<<createTripFilter tag:"""$tag$""" trip:"""$trip$""" prefix:"">> emptyMessage="Niets gevonden">
<span class="box"><<getLink>></span>
<span class="box"><<getDescription>></span>
<span class="box"><<getPrijs>></span>
<span class="box"><<getPeriode>></span>
</$list>
</
div>
\end

<$macrocall $name=list-body tag="Overnachting" trip={{$:/vak/curTrip}} />

You CAN NOT mix wikitext. You cannot put {{[[mylinke]]}} or [[{{!!mylink}}]]. You can not put <<macro param:{{othertiddler}}>>

That is why you need a macrocall widget to call your macro. This will not work:

<<list-body tag:"Overnachting" trip:"{{$:/vak/curTrip}}" >>

Because you are putting wikitext  {{$:/vak/curTrip}}  inside of wiki text <<list-body ...>>

This will not work:

<<createTripFilter tag:"""$tag$""" trip:[[$trip$]] prefix:"">><br>

Because you are putting [[$trip$]] inside of wikitext macro <<createTripFilter....>>

HTH
-- Mark

Chris Brouwer

unread,
Jan 25, 2019, 1:58:03 PM1/25/19
to TiddlyWiki
Thanks very much, Mark!

I have tried something like this, but probably still made a mistake somewhere.

This is working as expected.
Reply all
Reply to author
Forward
0 new messages