On Thursday, March 18, 2021 at 2:55:41 AM UTC-7 [email protected] wrote:
> <$set name="bookCount" filter="[author{!!title}count[]]">
> <$reveal type="eq" default=<<bookCount>> text=0> No books </$reveal>
> <$reveal type="eq" default=<<bookCount>> text=1> <<bookCount>> book
> </$reveal>
> <$reveal type="gt" default=<<bookCount>> text=1> <<bookCount>> books
> </$reveal>
> </$set>
> The above works but only for more books than 1 (the final, `gt` clause).
> If it's 0 or 1 books, nothing is returned.
> What am I missing?
>
Use type="match", not type="eq"
Also, here's an alternative way to get the same output, using "inline
filters":
<$set name="bookCount" filter="[author{!!title}count[]]">
<$text text={{{ [<bookCount>match[0]then[No]else<bookCount>] }}} />
<$text text={{{ [<bookCount>!match[1]then[books]else[book]] }}} />
</$set>
enjoy,
-e
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/565d5fa9-e8c6-4219-b433-a038eb578887n%40googlegroups.com.