You say "doesn't work" without explaining what you mean. Is there no
output? The wrong output? These details are essential to understanding
what's happening.
You might start by a clear statement of what you want your template to look
for.
In any event, this:
[is[current]][tag[Subjective]]
should probably be this:
[is[current]tag[Subjective]]
In the first one you're listing everything that is current (the current
tiddler) AND everything tagged with "Subjective". That's probably not what
you meant. In the second one, you're using the template on the current
tiddler IF it is tagged with "Subjective". It seems like you also want to
prevent the template from being used if the dates field does not match
2020-05-01.
I think what you want is:
[is[current]tag[Subjective]regexp:dates[2020-05-01]]
In example 2, you do this:
<$set name="mytoday" value="{{my-now}}">
But variable "mytoday" never gets used that I can see. In any event, it
should probably be
<$set name="mytoday" value={{my-now}}>
The value "{{my-now}}" will give you the literal string "{{my-now}}"
HTH
On Friday, May 1, 2020 at 10:24:19 AM UTC-7, Dave Parker wrote:
>
> There's something fundamental about filters that I'm not getting:
>
> in the advanced search filter tester thingie, this works:
>
> EXAMPLE 1:
> [is[current]][tag[Subjective]]-[!regexp:dates[2020-05-01]]
>
> i.e. it lists the single tiddler with the correct dates field
>
>
> but in a viewtemplate tiddler:
>
> EXAMPLE 2:
> <$set name="mytoday" value="{{my-now}}">
> <$list filter="[is[current]][tag[Subjective]]-[!regexp:dates[2020-05-01]]"
> variable=null>
>
> {{||SubjectiveTemplate}}
> </$list></$set>
>
> it doesn't work
>
>
> this does work (carets not really in code, just to point out the
> difference):
>
> EXAMPLE 3:
> <$set name="mytoday" value="{{my-now}}">
> <$list
> filter="[is[current]]-[!tag[Subjective]]-[!regexp:dates[2020-05-01]]"
> variable=null>
> ^ ^
> {{||SubjectiveTemplate}}
> </$list></$set>
>
>
>
>
> but this doesn't work:
>
> EXAMPLE 4:
> <$set name="mytoday" value="{{my-now}}">
> <$list filter="[is[current]]-[!tag[Subjective]]-[!regexp:dates[<<mytoday>>]]"
> variable=null>
> ^
> {{||SubjectiveTemplate}}
> </$list></$set>
>
> all tiddlers are rendered as a match
>
>
> and neither does this:
>
> EXAMPLE 5:
> <$set name="mytoday" value="{{my-now}}">
> <$list filter="[is[current]]-[!tag[Subjective]]-[!regexp:dates<<mytoday>>]"
> variable=null>
> ^
> {{||SubjectiveTemplate}}
> </$list></$set>
>
> no tiddlers are rendered as a match
>
>
> Just wondering 2 things:
> A) why does EXAMPLE 1 work but not 2? (or why 3 and not 2)
> B) Although using <<mytoday>> outside of the filter does return the
> correct date, why does it not work inside the filter?
>
>
> Thanks,
> - Dave
>
--
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/eaef2fbc-50c8-43aa-8477-30c880459d7b%40googlegroups.com.