Mark,

Your other solution works exactly as I needed it. Thank you!

Best regards,
Hubert

On Thursday, 6 December 2018 16:56:18 UTC, Mark S. wrote:
>
> I hadn't looked closely at "contains".  
>
> The things to note are that "contains" takes a title list (a list of 
> titles) as input -- NOT a string of text. And, it only matches by complete 
> tokens from a specified list field. 
> So, this version of your code works IF you have the colon standing on it's 
> own:
>
>
> \define test1()
> <$set name=source value="$:/note">
> <$set name=content value=":">
> <<test2>>
> </$set>
> </$set>
> \end
>
> \define test2()
> <$list filter="[[$(source)$]contains:note[$(content)$]]">
> YES <<currentTiddler>>
> </$list>
> <$list filter="[[$(source)$]!contains:note[$(content)$]]">
> No <<currentTiddler>>
> </$list>
> \end
>
> <<test1>>
>
> This alternative version of your code probably comes closer to what you 
> wanted to do. It uses the *search* filter operator
>
> \define test1()
> <$set name=source value="$:/note">
> <$set name=content value=":">
> <<test2>>
> </$set>
> </$set>
> \end
>
> \define test2()
> <$list filter="[[$(source)$]search:note[$(content)$]]">
> YES <<currentTiddler>>
> </$list>
> <$list filter="[[$(source)$]!search:note[$(content)$]]">
> No <<currentTiddler>>
> </$list>
> \end
>
> <<test1>>
>
>
> Good luck
> -- Mark
>
>
> On Thursday, December 6, 2018 at 7:35:44 AM UTC-8, Hubert wrote:
>>
>> Hello,
>>
>> I'm trying to use the new *contains* filter to determine whether a field 
>> *note 
>> *in the tiddler *$:/note* contains a colon (:) but my code fails and I'm 
>> obviously doing something wrong. I'd appreciate if anyone could point me in 
>> the right direction.
>>
>> Here's my code:
>>
>> \define test1()
>> <$set name=source value={{$:/note!!note}}>
>> <$set name=content value=":">
>> <<test2>>
>> </$set>
>> </$set>
>> \end
>>
>> \define test2()
>> <$list filter="[[$(source)$]contains[$(content)$]]">
>> YES <<currentTiddler>>
>> </$list>
>> <$list filter="[[$(source)$]!contains[$(content)$]]">
>> No <<currentTiddler>>
>> </$list>
>> \end
>>
>> <<test1>>
>>
>> Thank you in advance.
>>
>> Best regards.
>> Hubert
>>
>>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/53580964-62b8-49f8-a7ef-9247a9c0f427%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to