Macro is showing both tiddlers without a field and tiddlers whose field matches input

29 views
Skip to first unread message

David Allen

unread,
Jan 2, 2016, 9:16:15 PM1/2/16
to TiddlyWiki
Hi. I'm having trouble with one of my macros, and I'm not sure why.

Here is the code:
\define empire_species(faction)
!!Species

<$list filter="[tag[empire_event]faction[$faction$]sort[year]]">
<$set name=theyear value={{!!year}}>
<$list filter="[tag[species]planet{!!planet}]" >
*<$link to=<<currentTiddler>> >
<<currentTiddler>>
 </$link>(<<theyear>>)

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

This is supposed to get a list of tiddlers tagged empire_event whose faction field matches the input, then get a list of species whose planet field matches the planet field of the empire event.  What it's actually doing is grabbing a list of species that don't have a planet field defined yet and appending the desired result of this macro to that list.

Does anyone know what I need to change to keep this from grabbing species that don't have the planet field?
Message has been deleted
Message has been deleted

David Allen

unread,
Jan 2, 2016, 11:02:11 PM1/2/16
to tiddl...@googlegroups.com
The first list widget, which gets empire events with the given faction value, works fine.  The problem is the inner list widget.

On Sat, Jan 2, 2016 at 9:02 PM, Matabele <matabe...@gmail.com> wrote:
Hi

Try adding the filter as a separate run:

<$list filter="[tag[empire_event]] +[faction[$faction$]sort[year]]">
<$set name=theyear value={{!!year}}>
<$list filter="[tag[species]] +[planet{!!planet}]" >

regards

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/NHN3h62TOz0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/3dade6f1-62a5-4a27-8fb2-29b7008d3a93%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
David Allen

David Allen

unread,
Jan 2, 2016, 11:09:27 PM1/2/16
to tiddl...@googlegroups.com
Never mind, figured it out.  I had some events that didn't get formatted correctly, so the value for planet that was passed into the loop was empty, resulting in every species that didn't have a planet field being shown.
--
David Allen

Eric Shulman

unread,
Jan 2, 2016, 11:35:03 PM1/2/16
to TiddlyWiki
On Saturday, January 2, 2016 at 6:16:15 PM UTC-8, David Allen wrote:
<$list filter="[tag[species]planet{!!planet}]" > 
Does anyone know what I need to change to keep this from grabbing species that don't have the planet field?

Try adding the "has[fieldname]" filter, like this (untested):

<$list filter="[tag[species]has[planet]planet{!!planet}]" >

enjoy,
-e

Reply all
Reply to author
Forward
0 new messages