Check the existence of an index: dataTiddler

67 views
Skip to first unread message

Mohammad

unread,
Feb 10, 2020, 3:11:13 AM2/10/20
to TiddlyWiki
Assume you have a dataTiddler (dictionary or json) with some indexes like aa bb cc, ...
how to check is an index is existed in this dataTiddler


One solution seems like below. here myDic tiddler is checked for the existence of uu index.

<$list filter="[[myDic]indexes[]] +uu" emptyMessage="not existed">
existed
</$list>



What do you think?

--Mohammad

TonyM

unread,
Feb 10, 2020, 6:21:52 AM2/10/20
to TiddlyWiki
Mohammad

If an index exists but has no value it may as well not exist. Can you simply get the value of a particular index and if its empty it does not exist (or is empty).

regards
Tony

Mohammad

unread,
Feb 10, 2020, 6:48:14 AM2/10/20
to TiddlyWiki
Tony!

indexes returns both empty and none empty ones.

So to address your question and check empty indexes I think as you said one can get the values and check with !is[blank]

--Mohammad

TonyM

unread,
Feb 13, 2020, 12:00:10 AM2/13/20
to TiddlyWiki
Mohammad,

Depending on how your list widget logic is implemented, as I understand it, if you try and return the value in an index, empty or non existing will produce nothing in the output of your filter (if it is the only value to be returned), if a value is returned the list body or list template will be used, so there's no need for a test for blank.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages