On Friday, December 11, 2020 at 7:05:32 AM UTC-8 Harry wrote:

> when I click the button, nothing changes. I wonder if this is because my 
> birth_year field also has "na" as a value, I changed all na to 0, but the 
> button still does not work.
> <$button> assign retired
> <$list filter="[has[birth_year]]">
>    <$list 
> filter="[<currentTiddler>get[birth_year]compare:integer:lt[1948]then<currentTiddler>!c_status[dead]!c_status[purged]]">
>       <$action-setfield c_status="retired" />
>    </$list>
> </$list>
> </$button>
>

A field value of "na" is equivalent to "0".  I tried the above code on 
TiddlyWiki.com, providing it with a tiddler named "test", containing a 
"birth_year" field containing "na".  After pressing the button, the "test" 
tiddler had a new "c_status" field added, containing a value of "retired".  
Note that to see this field and value, you have to edit the "test" tiddler.
 

> I then tried the following code to create a list, but the tiddler still 
> shows nothing. I wonder if you have any idea about what might be wrong with 
> my dataset? Many thanks!
> <$list filter="[has[birth_year]]">
>  <$list 
> filter="[<currentTiddler>get[birth_year]compare:number:gteq[1]compare:number:lteq[1948]]">
>       <<currentTiddler>><br>
>    </$list>
> </$list>
>

You left off the "then<currentTiddler>" syntax that follows the compare.  
Without this, the result of the filter is the value that you get[...] from 
the birth_year field, rather than the title of the matching tiddler.  Also, 
your first compare is "gteq[1]", so this would not match tiddlers where the 
"birth_year" field contains "0" (or "na").  If you change the filter to:
 <$list 
filter="[<currentTiddler>get[birth_year]compare:number:gteq[0]compare:number:lteq[1948]then<currentTiddler>]">
it will show tiddler titles for all tiddlers with a non-blank "birth_year" 
field, even those with a value of "0" or "na".

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a457d3e7-952f-4109-aef1-5d9b8802a43en%40googlegroups.com.

Reply via email to