Following up with a relevant link.

https://ooktech.com/jed/ExampleWikis/FilterLogicExamples/



On Wednesday, August 26, 2020 at 8:22:48 PM UTC-4 TW Tones wrote:

> Amreus,
>
> Filters are a little different to standard boolean logic since they start 
> from a premise of generating a list of tiddler titles
>
> The following is a quick and untested response, please experiment.
>
> In your example
> [is[current]has[birt_date]] [is[current]has[birt_plac]]
> The result will be two values (title of the current tiddler) if both 
> fields have a value, but since the value is the same, the current tiddler 
> title it will be de-duplicated to one tiddler title.
>
> Perhaps one could write this as
> [(A!!B) or (A!!C)] where A is just a qualifier as to which B and which C 
> to use. The result returned will be blank for false or A for true.
>
> There are no parenthesis for order since the order is left to right. 
> Filters operate on the output of the previous step or each run is an AND.
> [[title1]] [[Title2]] represents both two titles and two runs like 
> [prefix[title1]] [prefix[Title2]] and the results of both runs are joined 
> and de-duplicated
>
> In the Doco Maths https://tiddlywiki.com/#Mathematics%20Operators it 
> explains how to stop de-duplication for undertaking maths.
>
> Back to your original question
> [{!!birt_date}] [{!!birt_plac}] will list the content of the fields if 
> they have a value, A is implicit in the "!!fieldname"
>
> You can also get the value of a field, if no value it will not return a 
> value 
> [is[current]get[birt_date]] [is[current]get[birt_plac]]
>
> but I'm not sure how to write [A and (B or C)] in filter.
>
> I think you already have? '[is[current]has[birt_date]] 
> [is[current]has[birt_plac]]'
> However The Test for A is not really a test, just a reference to a 
> particular tiddler
>
> Personally I suggest learning the filter syntax from the angle of its 
> original purpose, titles, since tiddlers are the atomic unit in tiddlywiki, 
> you will then start to discover ways to emulate other logical operations.
>
> Some quick examples
> [is[current]has[birt_date]has[birt_plac]] title returned only if they 
> both have a value
>
> [is[current]has[birt_date]] +[is[current]has[birt_plac]] title returned 
> only if first then second is true, the second is free to refer to anything 
> so you needs to specify current if thats what you want
>
> Rather than return the title you can now use then and else to set the 
> output
>
> [is[current]has[birt_date]then[yes]else[no]]  
>
> Finally;
> Remember with the list widget the output of a filter, if true or a list is 
> generated to apply it for each title to the contents of the list.
>
> Sometimes if the list is used to display content only we may use 
> +[limit[1]] so if anything satisfies the filter it will display the content 
> once.
>
> Regards
> Tony
>
>
> On Thursday, 27 August 2020 07:44:12 UTC+10, amreus wrote:
>>
>> Good evening. 
>>
>> Just a question of curiosity.  Can this filter be simplified? For 
>> example, can all[current] be "factored out" so it does not need to 
>> appear twice?  
>>
>> [is[current]has[birt_date]] [is[current]has[birt_plac]]
>>
>> In Boolean, I think this would be [(A and B) or (A and C)] == [A and (B 
>> or C)], but I'm not sure how to write [A and (B or C)] in filter. 
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7b8c6e78-9701-49fc-a3c1-18d556a55011n%40googlegroups.com.

Reply via email to