Reveal based on presence or absense of tiddler field?

62 views
Skip to first unread message

leeand00

unread,
Jan 17, 2018, 9:29:09 AM1/17/18
to TiddlyWiki
I have a tiddler with the following:

<$set name="myVariable" filter="[all[current]has[catanchor]]" value="1" emptyValue="0">

<$text text=<
<myVariable>>/>

<$reveal type="match" state=<
<myVariable>> text="1">

FIELD PRESENT

</$reveal>

<$reveal type="match" state=<
<myVariable>> text="0">

NO FIELD

</$reveal>

</$set>
NewTiddler
field:catanchor


The above example somewhat works,

If the field catanchor is not present
myVariable is set to 0 and is displayed.
Conversely, if it is present,
myVariable is set to 1 and is displayed.


But I am unable to reveal the text based on the value of
myVariable.


It almost seems as though I'm going to be required to set a state shadow tiddler and pull the value from there, which seems like alot of trouble to through just to display and hide text. 


Is it possible to do this based on a variable instead? 

(What I'm putting between the $reveal blocks is more complex than that which is in the example)


Thank you,
  Andrew J. Leer




Thomas Elmiger

unread,
Jan 17, 2018, 9:54:59 AM1/17/18
to TiddlyWiki
Hi Andrew,

as Eric pointed out some time ago in https://groups.google.com/d/msg/tiddlywiki/my9YIZEPGng/g_WCNmGuBwAJ

… you could use reveal like this with the default attribute:

<$reveal text="1" type="match" default=<<myVariable>> >

Alternatively you could use a list widget with filter to display content if the filter is true …

All the best,
Thomas

PMario

unread,
Jan 17, 2018, 9:58:23 AM1/17/18
to TiddlyWiki
On Wednesday, January 17, 2018 at 3:54:59 PM UTC+1, Thomas Elmiger wrote:
Alternatively you could use a list widget with filter to display content if the filter is true …

The list widget also has an "emptyMessage" parameter, that can be used if the filter doesn't return a result. 

-m 

leeand00

unread,
Jan 17, 2018, 11:01:09 AM1/17/18
to TiddlyWiki
Thank you Thomas that did the trick! :)
Reply all
Reply to author
Forward
0 new messages