[SOLVED] is[missing] !is[tiddler]

91 views
Skip to first unread message

Mohammad

unread,
Feb 20, 2019, 10:47:22 AM2/20/19
to tiddl...@googlegroups.com

It states !is[tiddler] is equal to is[missing] 

It states missing is all non-existent tiddlers to which there is at least one hard link

Can I check if a title is a tiddler or NOT?

I mean does it check also for system and shadow tiddlers? If so, does the documentation need to be revised?


Example

Check if all names refer to an existing tiddler (shadow, system, tiddler)

<$list filter="[subfilter<names>] +[!is[missing]]">



Mohammad

PMario

unread,
Feb 20, 2019, 11:28:32 AM2/20/19
to TiddlyWiki

TonyM

unread,
Feb 20, 2019, 4:31:11 PM2/20/19
to TiddlyWiki
Mohamnad,

In the first and second paragraph of you post there is a subtle difference.

The first is talking about the filter opperator missing[].

The second is talking about missing tiddlers.

There are some extra notes on the use of missing opperator in the doco that should not be missed.

Regards
Tony

Mohammad

unread,
Feb 20, 2019, 4:44:50 PM2/20/19
to TiddlyWiki
Thanks Mario
Thanks Tony!

So, for checking if a title is an existing tiddler what can I do

[!is[tiddler]]   [is[missing]] [has[title]]


--Mohammad

TonyM

unread,
Feb 20, 2019, 5:33:11 PM2/20/19
to TiddlyWiki
Mohammad,

I a tiddler tagged for view template I recently added this to detect new tiddler titles 

"[all[current]is[missing]]"

in 
<$list filter="[all[current]is[missing]]" variable=null>

and for tiddlers that exist
[all[current]has:field[text]]
<$list filter="[all[current]has:field[text]]" variable=null>

In the exiting tiddler test the has:field[text] also accepts an empty text field.

Untested but

[all[current]!is[missing]]

Should work, in this case we are ensuring there is the current tiddler title being tested for missing.

WHy do I have this test in view template?

Because I want to detect when someone opens a non existing tiddler from the URL

eg

Regards
Tony

Mal

unread,
Feb 21, 2019, 2:22:51 AM2/21/19
to TiddlyWiki
Mohammad,



So, for checking if a title is an existing tiddler what can I do

[!is[tiddler]]   [is[missing]] [has[title]]

I think you can use any of these to test if a tiddler already exists.  When I put [[my tiddler title]!is[tiddler]] into Advanced Search/Filter, I get the output "my tiddler title" and, when I then create a tiddler with this title, I get no output.  This is all as expected according to the documentation for the "is" Operator.  Using "is[missing]" produces the same result.  Also, "!has[title]" or "!has[text]" seem to work just as well, although I think the first two are easier to interpret, so make the code a bit more readable.

Note that "is[tiddler]" and "is[missing]" treat shadow tiddlers as though they don't exist.  Which is OK because it is reasonable that you might want to create a tiddler to overwrite a shadow tiddler.  On the other hand, "has[title]" and "has[text]" don't ignore shadow tiddlers, so you need to decide which option suits your application.

Regards,

Mal

TonyM

unread,
Feb 21, 2019, 4:15:23 AM2/21/19
to TiddlyWiki
Mohammad,

Another method discovered recently is using the $view widget https://tiddlywiki.com/#ViewWidget

The content of the <$view> widget is displayed if the field or property is missing or empty.

This means if you want to display say the text or title field of a named tiddler, and no such text or title field exists the content will be displayed such that;

<$view tiddler=<<tiddlername>> field=title>
  Display when not exist, like a button to create it using a template
</$view>

So if the tiddler exists it will display its name, if not it can display the code to create it.

Regards
Tony

Mohammad

unread,
Feb 21, 2019, 9:08:44 AM2/21/19
to TiddlyWiki
Thanks Mal,
Thanks Tony,

I use this checking inside a list widget, so for me the [is[tiddler]] may be the most semantic form.

Best
Mohammad

Mohammad

unread,
Feb 21, 2019, 9:18:48 AM2/21/19
to TiddlyWiki
Added to TW-Scripts.


On Thursday, February 21, 2019 at 10:52:51 AM UTC+3:30, Mal wrote:
Reply all
Reply to author
Forward
0 new messages