[tw5] Re: Filter tiddlers with exactly one tag.

2021-09-21 Thread Eric Shulman
On Tuesday, September 21, 2021 at 10:52:04 PM UTC-7 thor...@gmail.com wrote:

> I tried to experiment with 
> `[enlist{!!tags}sort[]join[,]match[playground,rust,test,two words]]` and 
> uploaded the results. `[enlist{!!tags}sort[]join[,]]` returns the same 
> thing as `[enlist{!!tags}sort[]join[,]match[playground,rust,test,two 
> words]]` from my testing, so I'm not exactly sure what the match is for.
>

The filter I provided assumes that it is contained within a tiddler that 
has tags.  The purpose of the `match[playground,rust,test,two words]` 
filter syntax is to test the result of the filter to see if it has all the 
desired tags.

However... you can't use $:/AdvancedSearch to return "a list of tiddlers 
with exactly these 4 tags", because that needs two nested $list widgets, 
where the outer $list gets all the tiddler titles, and the inner $list 
checks each tiddler for the matching set of tags.  Thus, to list all 
tiddlers that have the desired tags, you can put the following into a 
tiddler:
```
<$list filter="[all[]]">
   <$list 
filter="[enlist{!!tags}sort[]join[,]match[playground,rust,test,two words]]" 
variable="has_matching_tags">
  <$link/>
   

```
Note the use of the variable in the inner $list.  This preserves the value 
of "currentTiddler" that is assigned by the outer $list so that it can be 
output by the $link widget.

-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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/fb36cc56-d93d-4d63-9d8a-164844c12c42n%40googlegroups.com.


[tw5] Re: Filter tiddlers with exactly one tag.

2021-09-21 Thread thor...@gmail.com
I tried to experiment with 
`[enlist{!!tags}sort[]join[,]match[playground,rust,test,two words]]` and 
uploaded the results. `[enlist{!!tags}sort[]join[,]]` returns the same 
thing as `[enlist{!!tags}sort[]join[,]match[playground,rust,test,two 
words]]` from my testing, so I'm not exactly sure what the match is for.

I'm not sure how to combine it with another filter to actually return a 
list of "these tiddlers with exactly these 4 tags". Is there a way to 
do "these tiddlers with exactly these 4 tags and nothing else" filter 
without using a variable (so I can put it into advanced search)?

On Tuesday, September 21, 2021 at 11:29:16 PM UTC-4 Eric Shulman wrote:

> On Tuesday, September 21, 2021 at 7:41:06 PM UTC-7 thor...@gmail.com 
> wrote:
>
>> I have 10 tiddlers tagged with both `playground` and `rust` 
>> (`[tag[rust]tag[playground]]` returns them all, but _pretend_ that I could 
>> have tiddlers with more than just two tags). In advanced search, 
>> `[field:tags[rust playground]]` returns 3 matches, and 
>> `[field:tags[playground rust]]` returns 7 matches. Meaning that Tiddlywiki 
>> knows the order that I put tags in even though they are sorted when 
>> displayed in the browser. Is there a way to return "exactly these 2 or 3 
>> etc" tags without having to try all permutations of tags?
>>
>  
> Let's assume you have FOUR tags: "rust", "playground", "two words", and 
> "test"
>
> Try this filter:
> `[enlist{!!tags}sort[]join[,]match[playground,rust,test,two words]]`
>
> Notes:
> * If a tag contains a space, it is stored with square brackets, e.g., 
> `[[two words]]`
> * enlist{!!tags} gets the individual tags as separate items, and any 
> square brackets are removed (but "two words" will still be ONE tag)
> * next, sort them alphabetically, in ascending order
> * then join the tags with a comma as a delimiter
> * and match with literal text containing commas
>
> Let me know how it goes.
>
> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f6c21926-6a5e-4c8f-870d-dc7edbe5f4f3n%40googlegroups.com.


Test Tiddler.json
Description: application/json


[tw5] Re: Filter tiddlers with exactly one tag.

2021-09-21 Thread Eric Shulman
On Tuesday, September 21, 2021 at 7:41:06 PM UTC-7 thor...@gmail.com wrote:

> I have 10 tiddlers tagged with both `playground` and `rust` 
> (`[tag[rust]tag[playground]]` returns them all, but _pretend_ that I could 
> have tiddlers with more than just two tags). In advanced search, 
> `[field:tags[rust playground]]` returns 3 matches, and 
> `[field:tags[playground rust]]` returns 7 matches. Meaning that Tiddlywiki 
> knows the order that I put tags in even though they are sorted when 
> displayed in the browser. Is there a way to return "exactly these 2 or 3 
> etc" tags without having to try all permutations of tags?
>
 
Let's assume you have FOUR tags: "rust", "playground", "two words", and 
"test"

Try this filter:
`[enlist{!!tags}sort[]join[,]match[playground,rust,test,two words]]`

Notes:
* If a tag contains a space, it is stored with square brackets, e.g., 
`[[two words]]`
* enlist{!!tags} gets the individual tags as separate items, and any square 
brackets are removed (but "two words" will still be ONE tag)
* next, sort them alphabetically, in ascending order
* then join the tags with a comma as a delimiter
* and match with literal text containing commas

Let me know how it goes.

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a27256ee-43a7-4029-8bee-73d89d16af06n%40googlegroups.com.


Re: [tw5] Re: [NOOB] need some help with filters OR instead of AND

2021-09-21 Thread Charlie Veniot
That makes my day, Pete!  Thanks!


On Tuesday, September 21, 2021 at 3:31:34 AM UTC-3 peterdart...@gmail.com 
wrote:

> Thank you so much Charlie!
> All working,
>  I owe you a beer or two!. 
>
> if you are ever in Melbourne look me up :) (assuming we will get out of 
> our lockdown and current mess sometime soon)
>
> just what i needed.
>
>
> On Tue, 21 Sept 2021 at 02:04, Charlie Veniot  wrote:
>
>> Just for conversation's sake, download the attached and drag it into 
>> tiddlywiki.com .
>>
>> On Monday, September 20, 2021 at 5:36:59 AM UTC-3 peterdart...@gmail.com 
>> wrote:
>>
>>> Thanks for the hints, 
>>> I am understanding more about TW5 and learning, but still no cigar.
>>>
>>> I will explain what i am trying to achieve it may make things easier 
>>> (feels like there will be a pre-canned solution out there). I have added a 
>>> fair amount of content to a wiki +80 pages, diagrams and tiddlymap all 
>>> working well, there are common tags that are reused to assist with 
>>> classification and content. I am was hoping to provide an interactive, easy 
>>> to use search page that lets the end readers narrow down the pages with a 
>>> combination of tags, it may take about 3 tags to find the pages you are 
>>> looking for, but could be more. I understand that i can do this in advance 
>>> search - just trying to make it easy for others with pulldowns, and no 
>>> typing...etc.
>>>
>>> I feel like i am getting closer, and have found the source of the 
>>> original macro i used, but still not the result i am looking for, looks 
>>> like the macro i found and tried to use is too old. (skip the rest of this 
>>> paragraph if you dont need the detail ). The example tagfilter() i found 
>>> and tried to implement looks like it was created a while ago as an example 
>>> by @tobibeer and may not actually have made it into the core (
>>> http://tagfilter.tiddlyspot.com/). The online tagfilter shown in the 
>>> link does filter and work the way i wanted it to with AND logic, however 
>>> when i have added it to my wiki it works with OR. From reading comments in 
>>> github it looks like the changes to "tagging" that this macro used were not 
>>> actually added to core and it was superseded by the "contains:tags" filter 
>>> logic. I tried adding more of what is listed as dependencies in github for 
>>> the macro but ended up with lots of javascript errors and crash on startup, 
>>> (did manage to recover from backup) .
>>>
>>> In that old macro, i think this line that filters and displays the list 
>>> is  this one
>>> [all[current]tags[]tagging:all[]]
>>> where it is taking the list of tags that the user has selected 
>>> ("current" and have been added to a temp page) and finding all the tiddlers 
>>> that *some* contain the same tags, where i want it to contain *all* of the 
>>> same tags. From reading i need to replace that part with something that 
>>> includes "contains:" (maybe) 
>>>
>>> What i am trying to achieve in English is.. "How do i find a list of all 
>>> pages that contain all the tags of the current temp page?"
>>>
>>> Once again thanks in advance,
>>> Pete
>>>
>>>
>>>
>>> On Sunday, 19 September 2021 at 12:51:00 am UTC+10 cj.v...@gmail.com 
>>> wrote:
>>>
 G'day Pete,

 Although that stretch of code is too big and complicated for me to wrap 
 my mind around it, I've thrown two sample filters into TiddlyWiki.com's 
 Advanced Search tiddler and did a couple of screen captures (attached), 
 just to show the basics of setting up "and" vs "or".



 On Friday, September 17, 2021 at 5:59:34 AM UTC-3 
 peterdart...@gmail.com wrote:

> Hey Guys
> Apologies if this is a duplicate. This could be a simple answer but i 
> have been looking at it for days and still not getting there.
> I am using a macro i found on the web called tagfilter 
> ($:/.tb/macros/tagfilter), just had another look and i can't see where i 
> got it from. Its pretty simple just pick a set of tags and then lookup 
> the 
> pages that match and display the list. I want to modify it so that it 
> just 
> returns the ones that have ALL of the tags picked rather than ANY.
> I think the line in the macro that is doing the filter is this
>
> <$list 
> filter="[!is[system]sort[]]+[all[current]tags[]tagging:all[]]+[sort[]]-[all[current]]"
>  
> template="$template$"/>
>
> I think its the "tagging" part that is picking up pages with ANY of 
> the tags... question is what do i replace it with?
>
> This is the full macro incase i am misleading people on the line that 
> is doing the filter
>
> \define lingo-base() $:/language/EditTemplate/
>
> \define 
> tagfilter(filter:"[!is[system]sort[]]",state:"$:/temp/TagFilter", 
> template:"$:/core/ui/ListItemTemplate")
> <$set name=state value="$state$">
> <$tiddler tiddler=<>>
> <$set name=tags filter="[all[current]tags[]]">
>>>

[tw5] Re: Filter tiddlers with exactly one tag.

2021-09-21 Thread thor...@gmail.com
`<$list 
filter="[field:tags[technical_todo]]"><>`

I'd like to add: this works beautifully for my use case as described. I'd 
like to extend the use case however, and I'm not sure this filter works 
as-is.

I have 10 tiddlers tagged with both `playground` and `rust` 
(`[tag[rust]tag[playground]]` returns them all, but _pretend_ that I could 
have tiddlers with more than just two tags). In advanced search, 
`[field:tags[rust playground]]` returns 3 matches, and 
`[field:tags[playground rust]]` returns 7 matches. Meaning that Tiddlywiki 
knows the order that I put tags in even though they are sorted when 
displayed in the browser. Is there a way to return "exactly these 2 or 3 
etc" tags without having to try all permutations of tags?

On Tuesday, September 21, 2021 at 4:49:17 PM UTC-4 cj.v...@gmail.com wrote:

> That *is* short, sweet and nice.  I do enjoy.
>
> However, am I correct in saying that this only works if tags are one word 
> or CamelCase words?
>
> *(I always use spaces in my multi-word tags because I find that easier to 
> read.  And they wind up double-bracketed by TiddlyWiki in the tags fields.)*
>
> On Tuesday, September 21, 2021 at 5:24:41 AM UTC-3 Eric Shulman wrote:
>
>> On Monday, September 20, 2021 at 7:38:43 PM UTC-7 thor...@gmail.com 
>> wrote:
>>
>>> ...is there a shorthand to only output those tiddlers with _exactly_ the 
>>> one tag I'm requesting
>>>
>>
>> Even though the "tags" field contains a list of tiddler titles, it is 
>> also just a simple text value and you can use the `fields:tags[...]` filter 
>> to look for a specific literal value in the field, without it as a list.
>>
>> `<$list 
>> filter="[field:tags[technical_todo]]"><>`
>> will give the results you want, without a lot of messy "counting" and 
>> such.
>>
>> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6d017458-c822-4d30-b5dc-ff185a1eb653n%40googlegroups.com.


[tw5] Re: Filter tiddlers with exactly one tag.

2021-09-21 Thread Charlie Veniot
That *is* short, sweet and nice.  I do enjoy.

However, am I correct in saying that this only works if tags are one word 
or CamelCase words?

*(I always use spaces in my multi-word tags because I find that easier to 
read.  And they wind up double-bracketed by TiddlyWiki in the tags fields.)*

On Tuesday, September 21, 2021 at 5:24:41 AM UTC-3 Eric Shulman wrote:

> On Monday, September 20, 2021 at 7:38:43 PM UTC-7 thor...@gmail.com wrote:
>
>> ...is there a shorthand to only output those tiddlers with _exactly_ the 
>> one tag I'm requesting
>>
>
> Even though the "tags" field contains a list of tiddler titles, it is also 
> just a simple text value and you can use the `fields:tags[...]` filter to 
> look for a specific literal value in the field, without it as a list.
>
> `<$list 
> filter="[field:tags[technical_todo]]"><>`
> will give the results you want, without a lot of messy "counting" and such.
>
> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/06a49bed-d604-4c86-94cb-6b341ec24558n%40googlegroups.com.


[tw5] Re: Filter tiddlers with exactly one tag.

2021-09-21 Thread Eric Shulman
On Monday, September 20, 2021 at 7:38:43 PM UTC-7 thor...@gmail.com wrote:

> ...is there a shorthand to only output those tiddlers with _exactly_ the 
> one tag I'm requesting
>

Even though the "tags" field contains a list of tiddler titles, it is also 
just a simple text value and you can use the `fields:tags[...]` filter to 
look for a specific literal value in the field, without it as a list.

`<$list filter="[field:tags[technical_todo]]"><>
`
will give the results you want, without a lot of messy "counting" and such.

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/dc1023c2-e1cd-469b-b29c-6b35ed92fd7cn%40googlegroups.com.