Difference between has:field[xxx] and has[xxx]

97 views
Skip to first unread message

Mohammad

unread,
Jan 10, 2019, 2:50:43 AM1/10/19
to TiddlyWiki
What is the difference between

Case I:

<$list filter="[has[xxx]]">


</$list>


and

Case II:

<$list filter="[has:filed[xxx]]">


</$list>


Testing on tiddlywiki.com returns different results if there are tiddlers having xxx field but they are EMPTY or NOTE!

The first case does not return anything when the field xxx is empty but the second case returns results independent of field value (empty / non-empty).


--Mohammad

TonyM

unread,
Jan 10, 2019, 3:28:04 AM1/10/19
to tiddl...@googlegroups.com
Mohammad,

You have answered your own question. That is the difference. Both return nothing if a field does not exist, thus emptyValue or emptyMessage return values. With this behaviour you can test all three posibilities. The field[] operator is not so comprehencive.


I think of has[fieldname] as has value, and
has:field[fieldname] as has field or value.


If the fieldname does not exist neither of the above work


Using the Not (need to test)


!has[fieldname] No fieldname at all
!has:field[fieldname] No fieldname at all


Regards
Tony

Mohammad

unread,
Jan 10, 2019, 6:09:01 AM1/10/19
to tiddl...@googlegroups.com
Thanks Tony!
 So a third case is non-existed filed where both cases result nothing!

has[fieldname] then is HAS VALUE and NOT there is such filed!

I hope this can be added to documentation.


--Mohammad

TonyM

unread,
Jan 10, 2019, 7:20:03 AM1/10/19
to TiddlyWiki
I Updated my last post for the nots'

Tony


On Thursday, January 10, 2019 at 10:09:01 PM UTC+11, Mohammad wrote:
Thanks Tony!
 So a third case is no-existed filed where both cases result nothing!

Thomas Elmiger

unread,
Jan 10, 2019, 7:34:09 AM1/10/19
to TiddlyWiki
Mohammad, watch out for typos: filed and field are not the same.

has:field[fieldname] and has:filed[] do different things. The second checks the existence of a field named filed.

https://tiddlywiki.com/#has%20Operator

All the best,
Thomas

Mohammad

unread,
Jan 10, 2019, 2:57:03 PM1/10/19
to TiddlyWiki
Thanks Thomas!

Tony has already made a long note about this typo. Yes, I means field. 
You are right, It seems has:value[] and has[] are the same and need a non-empty field to return result.


--Mohammad

Mohammad

unread,
Jan 10, 2019, 2:58:17 PM1/10/19
to TiddlyWiki
Tony
You are right, see below table from : https://tiddlywiki.com/#has%20Operator

purposefilter the input by field existence
inputselection of titles
suffixF =  NEW IN: 5.1.14 optionally, the name of a field
parameterF = the name of a field
outputwithout suffix or with suffix value
» those input tiddlers in which field F has a non-empty value
suffix field
» those input tiddlers in which field F exists
! outputwithout suffix or with suffix value
» those input tiddlers in which field F does not exist or has an empty value
suffix field
» those input tiddlers in which field F does not exist


Cheers
Mohammad
Reply all
Reply to author
Forward
0 new messages