Use filed in filter

73 views
Skip to first unread message

Mohammad

unread,
Jun 2, 2018, 11:41:39 PM6/2/18
to TiddlyWiki
Consider this code:

<$list filter="[field:note[]]">
<<currentTiddler>><br>
</$list>


If you put in a tiddler in tiddlywiki.com, then it returns all tiddlers. while I expect to return all tiddlers having a filed called note


If you remove [] from note, TW returns an error, if you put something inside [] as input parameter, it works fine and look for note filed containing that input.

Eric Shulman

unread,
Jun 3, 2018, 12:40:27 AM6/3/18
to TiddlyWiki
On Saturday, June 2, 2018 at 8:41:39 PM UTC-7, Mohammad wrote:
Consider this code:

<$list filter="[field:note[]]">
<<currentTiddler>><br>
</$list>


If you put in a tiddler in tiddlywiki.com, then it returns all tiddlers. while I expect to return all tiddlers having a filed called note

Try the "has:fieldname[]" filter operator.  This will select only tiddlers that have "fieldname" defined, even if the field has no value assigned.  If you intend to list only those tiddler that have actual values for a field, you can use the "has[fieldname]" form of the filter, which selects only tiddlers with that field having a **non-blank** value.

-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals

Mark S.

unread,
Jun 3, 2018, 12:43:45 AM6/3/18
to TiddlyWiki
From TiddlyWiki.com, field operator tiddler:


If S is empty, field will match both of the following:

  • tiddlers that don't contain field F
  • tiddlers in which field F exists but has an empty value
So, it returns everything because  note doesn't exist anywhere. What you probably want is the "has" operator:

[has[note]]


HTH
-- Mark


On Saturday, June 2, 2018 at 8:41:39 PM UTC-7, Mohammad wrote:

Mohammad

unread,
Jun 3, 2018, 4:39:05 AM6/3/18
to TiddlyWiki
Thank you Eric
Thank you Mark,

Yes, I got the point now! I meant the tiddler has the filed, so I have to use the has operator.

Cheers
Mohammad

TonyM

unread,
Jun 3, 2018, 10:00:10 AM6/3/18
to TiddlyWiki
And as Eric said
Reply all
Reply to author
Forward
0 new messages