On Tuesday, November 6, 2018 at 4:03:09 PM UTC-8, TonyM wrote:
>
> I am trying to make a simply comparison between two variables or one 
> variable and a fields content.
> eg; <<currentWiki>> and  {{!!wiki-owner}}
> or <<currentWiki>> and  <<wiki-owner>>
> I simply want a simple test or filter that will be true if they are the 
> same 
> and that will be false if they are the same 
>

Although it might not be obvious, the $reveal widget can do this very 
easily.  Normally, the $reveal widget is used to compare a "text" value 
with a value stored in the text field of a specified "state" tiddler, like 
this:

<$reveal type="match" state="$:/state/SampleReveal1" text="show">
  show this if state tiddler content matches text param
</$reveal>


However, there is an alternative syntax that allows comparisons between any 
two values: while the "state" param can only use an implied reference to 
the "text" field of a specified tiddler, the "default" param can use ANY 
literla, field or variable reference.  Simply OMIT the "state" param and 
use the "default" param in it's place, like this:

<$reveal type="match" default={{somefield!!sometiddler}} text="show">
   show this if somevariable value matches text param
</$reveal>

or

<$reveal type="match" default=<<somevariable>> text="show">
   show this if somevariable value matches text param
</$reveal>


and... since the "text" param also can use ANY field or variable reference, 
you can use <$reveal> to compare any two variables, like this:

<$reveal type="match" default=<<somevariable>> text=<<someOtherVariable>>>
   show this if somevariable value matches text param
</$reveal>


and... you can use any of the valid "type" values to make the comparison, 
including the recently added LT, GT, LTEQ and GTEQ types.

For example:

<$set name="todo" filter="[tag[todo]count[]]">
<$set name="done" filter="[tag[done]count[]]">
<$reveal type="match"   default=<<todo>> text="0"> There is nothing to do. 
</$reveal>
<$reveal type="nomatch" default=<<todo>> text="0">
   <$reveal type="match" default=<<done>> text="0">      You haven't 
started.                             </$reveal>
   <$reveal type="LT"    default=<<todo>> text=<<done>>> You're making 
progress... keep going!            </$reveal>
   <$reveal type="match" default=<<todo>> text=<<done>>> You're half way 
there... take a short break      </$reveal>
   <$reveal type="GT"    default=<<todo>> text=<<done>>> You've done a 
lot... but there's still some left </$reveal>
</$reveal>
</$set>
</$set>

Hope this helps.

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

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/9fefb7ad-af42-4361-84a9-6efb3ec5abef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to