Re: [tw] Re: Best "equal" operator?

2017-09-09 Thread Mat
Stephan, you're right. That is a much clearer! Thanks!

<:-)

-- 
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/737ba73f-77dc-4bae-8426-7052ea369502%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Best "equal" operator?

2017-09-09 Thread Stephan Hradek
What's wrong with

<$reveal state="mytiddler!!myfield" type="match"   text="foo" 
 > value is foo 
<$reveal state="mytiddler!!myfield" type="nomatch" text="foo" 
default="foo"> value is not foo 


-- 
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/22547d7f-f9b7-47eb-bacb-42c35aaf66af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Best "equal" operator?

2017-09-06 Thread Mat
A special use case of the above, for reference:

The following is to distinguish if a field has a *specific *value or *any 
other arbitrary* value (ie. that you don't know beforehand).

In this example, it is a field named "myfield" that has either the specific 
value foo or an arbitrary value.

<$list filter="[[mytiddler]myfield[foo]]"> value is foo 
<$list filter="[[mytiddler]get[myfield]] -foo"> value is not foo 

(You might want to add checks if the field exists at all etc)

In my real case, I use it as a way to distinguish between if something is a 
tag (specific value is tag) or a field (any arbitrary name).

I figure this was worth posting because of the non-symmetry that makes it 
less than obvious. If Mark S' PR 
 is accepted then this 
would be simpler and symmetrical.


<:-)

-- 
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/08a14971-8faa-4b6c-b2d3-53017723554f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Best "equal" operator?

2017-08-29 Thread Thomas Elmiger
Argh – why do I keep forgetting such elementary tricks?
Thank you, Eric!

2017-08-29 8:46 GMT+02:00 Eric Shulman :

> On Monday, August 28, 2017 at 11:41:05 PM UTC-7, Thomas Elmiger wrote:
>>
>> In my tests for the macro linked above I compared the reveal-way (it was
>> suitable for my case). I decided to not use reveal because of the
>> limitation of the reveal widget: You can’t use variables for both sides of
>> the comparison.
>>
>
> Actually, you CAN use variables for both "sides" of the reveal if you
> OMIT the "state" param, you can use the "default" param instead... like
> this:
>
> <$reveal text=<> type="match" default=<> >
><> equals <>
> 
>
> enjoy,
> -e
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "TiddlyWiki" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/tiddlywiki/my9YIZEPGng/unsubscribe.
> To unsubscribe from this group and all its topics, 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/efd34bcc-07d7-4fc5-b11c-1633d4b691d4%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CALXLrThXrTg%3DDbREy%3Dh0VJheZ-qEbNj79A3pj3_fEvtZJTt44w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Best "equal" operator?

2017-08-29 Thread Eric Shulman
On Monday, August 28, 2017 at 11:41:05 PM UTC-7, Thomas Elmiger wrote:
>
> In my tests for the macro linked above I compared the reveal-way (it was 
> suitable for my case). I decided to not use reveal because of the 
> limitation of the reveal widget: You can’t use variables for both sides of 
> the comparison. 
>

Actually, you CAN use variables for both "sides" of the reveal if you 
OMIT the "state" param, you can use the "default" param instead... like 
this:

<$reveal text=<> type="match" default=<> >
   <> equals <>


enjoy,
-e

-- 
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/efd34bcc-07d7-4fc5-b11c-1633d4b691d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Best "equal" operator?

2017-08-29 Thread Thomas Elmiger
In my tests for the macro linked above I compared the reveal-way (it was
suitable for my case). I decided to not use reveal because of the
limitation of the reveal widget: You can’t use variables for both sides of
the comparison. One – and users would have to know which one – would have
to be a text reference like "!!fieldname". This also requires that users
grasp the concept of text references. On the other hand if you use
variables, it is easy to transclude a text reference’s value as value of
the variable – {{!!fieldname}} does the job.

2017-08-29 8:31 GMT+02:00 Stephan Hradek :

>
>
> Am Montag, 28. August 2017 23:44:51 UTC+2 schrieb Thomas Elmiger:
>>
>>
>> @Stephan, do you suggest it would be better to use the reveal widget?
>>
>> No, I'm just wondering whether it might work.
>
> I'm yet to completely understand the use case.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "TiddlyWiki" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/tiddlywiki/my9YIZEPGng/unsubscribe.
> To unsubscribe from this group and all its topics, 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/c09b42b0-61d2-40d0-8921-fde3e314bfed%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CALXLrThgN2ZNXasYfvfJGC%2BUj6ZV%2B9yo0Rx%3Dh87ciy7gaY%3D2gw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Best "equal" operator?

2017-08-29 Thread Stephan Hradek


Am Montag, 28. August 2017 23:44:51 UTC+2 schrieb Thomas Elmiger:
>
>
> @Stephan, do you suggest it would be better to use the reveal widget?
>
> No, I'm just wondering whether it might work.

I'm yet to completely understand the use case. 

-- 
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/c09b42b0-61d2-40d0-8921-fde3e314bfed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Best "equal" operator?

2017-08-28 Thread 'Mark S.' via TiddlyWiki
Here's a javascript filter  "equals" (based on 'field') to try. Since it 
compares based on text, not fields, operations like equals:myfield are 
meaningless. I left code in there that can process regular expressions, but 
didn't test if it still works since that approach to regular expressions 
has been deprecated.

After installing, these tests seemed to work as expected depending on what 
variables were set:

<$vars foo="stuff" bar="stuff">
<$list filter="[equals]">
THEY MATCH!


<$list filter="[!equals]">
THEY DON'T MATCH!





Have fun,
Mark

On Sunday, August 27, 2017 at 12:45:22 PM UTC-7, Mat wrote:
>
> I often want to test if e.g a field or variable has a certain value. How 
> do I best do this in a filter?
>
> [{foo!!bar}EQUALS[frotz]]
>
> ...what is "EQUALS" ?
>
> <:-)
>

-- 
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/cb6f18f2-7f53-442a-a6bc-d1961ec553ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


$__core_modules_filters_equals.js.json
Description: application/json


Re: [tw] Re: Best "equal" operator?

2017-08-28 Thread Thomas Elmiger
Eric’s solution works without title:

<$vars foo="froz" bar="froz">
<$list filter="[] -[]" emptyMessage="match">
no match



@Stephan, do you suggest it would be better to use the reveal widget?

-- 
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/CALXLrTipJ6atF5opaTjTufqWnGe6xeLmSxzdfk%3DXK-_-ODKafA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Best "equal" operator?

2017-08-28 Thread 'Mark S.' via TiddlyWiki
If you can call the filter as a macro, or call a macro to make the filter, 
then this works:

\define compare(foo,bar)
<$list filter="[title[$foo$]regexp[^$bar$$]]" emptyMessage="no match">
Matches! 

\end

<>

It needs to be set up as a macro so it can use regexp[^$bar$$] (or 
regexp[^$(bar)$$] if passed as an environmental variable.

What I don't understand, is why THIS doesn't work:

<$vars foo="stuff" bar="stuff">
<$list filter="[titlefield:title]" >
Matches!



I've looked over the spec.s for the field operator. It should select an 
input title if an only it matches it's parameter. And the title operator 
should generate a tiddler title to be matched. But it doesn't seem to work 
that way. Instead, the field:title only returns the input title if the 
input title actually exists as a tiddler. But the spec's don't say that.

Good luck!
Mark



On Sunday, August 27, 2017 at 12:45:22 PM UTC-7, Mat wrote:
>
> I often want to test if e.g a field or variable has a certain value. How 
> do I best do this in a filter?
>
> [{foo!!bar}EQUALS[frotz]]
>
> ...what is "EQUALS" ?
>
> <:-)
>

-- 
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/185d7e6d-6f12-404d-a4db-ddcb5047faa9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Best "equal" operator?

2017-08-28 Thread Stephan Hradek


Am Montag, 28. August 2017 15:13:42 UTC+2 schrieb Mat:
>
> Thank you guys! As noted, the need is for it to be used inside a filter
>

And you cannot put the "equal" outside the filter to use reveal? 

-- 
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/42308587-17f4-4e81-b286-bb877f439c2d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Best "equal" operator?

2017-08-28 Thread Mat
Thank you guys! As noted, the need is for it to be used inside a filter so 
Erics suggestion is the closest. It does have the limitation that you can't 
have other stuff in the filter because the filter will never be empty then. 
That's, of course, not what I asked for but I tried to simplify the 
question. Hopefully I can use this as a wrap around yet another filter.

Thank you!!

<:-)

-- 
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/3f7b8b13-71e7-41fc-886d-b2f7a5e73d44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Best "equal" operator?

2017-08-28 Thread Stephan Hradek
What about the $reveal widget?

-- 
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/09a3-d1c8-49d9-8fc6-33cbe31be010%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Best "equal" operator?

2017-08-27 Thread Eric Shulman
On Sunday, August 27, 2017 at 1:12:36 PM UTC-7, Mat wrote:
>
> Doh! I knew that... how embarrassing. 
>
> Still thanks - but the the question should only have been regarding 
> *variables*.
>
> [EQUALS[frotz]]
>

try this:
<$vars foo="bar">
<$list filter="[title] -[[bar]]" emptyMessage="foo EQUALS bar">
   foo does NOT EQUAL bar



The [title] part of the filter dominantly appends the value of the 
variable.  Then the -[[bar]] part removes the literal value "bar".  If the 
result is an empty list, then foo is EQUAL to bar.  If the result is NOT 
empty, then we can say that foo does NOT EQUAL bar.

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/d93e3bd9-1c1b-4d19-84c6-2884ed9b07a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Best "equal" operator?

2017-08-27 Thread Mat
Doh! I knew that... how embarrassing. 

Still thanks - but the the question should only have been regarding 
*variables*.

[EQUALS[frotz]]


<:-)

-- 
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/a710b882-aa35-40b5-a054-6f30d195b966%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.