Thanks, Eric. Worked as advertised and gave me some examples for the future.

On Tuesday, December 31, 2019 at 12:11:30 PM UTC-8, Eric Shulman wrote:
>
> On Tuesday, December 31, 2019 at 11:34:51 AM UTC-8, Scott Kingery wrote:
>>
>> In a current project, I have tiddlers that use a couple of fields that 
>> keep running totals. We'll call them time_total and grand_total. I'd like 
>> to create a button that sets the value to 0 in all tiddlers containing 
>> those fields. Basically, a reset button. Has anyone crafted such a thing? I 
>> know there are tools like Mohammad's Commander Plugin and that might be the 
>> safer route but I thought I'd ask.
>>
>
> There are filters for finding tiddlers with specific fields.  Thus:
>
> <!-- show tiddlers and values (just so we know it works) -->
> <$list filter="[has[time_total]] [has[grand_total]]">
>    <<currentTiddler>> time_total={{!!time_total}} 
> grand_total={{!!grand_total}}<br>
> </$list>
>
> <!-- HERE'S THE BUTTON -->
> <$button> reset totals
>    <$list filter="[has[time_total]] [has[grand_total]]">
>       <$action-setfield time_total="0" grand_total="0" />
>    </$list>
> </$button>
>
> note: the filter tests for any tiddler that has *non-blank* values for 
> time_total OR grand_total.  If you want to test for tiddlers that have 
> either of those fields, even if blank, use:
> <$list filter="[has:field[time_total]] [has:field[grand_total]]">
>
> 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/3a0f6cc3-b4aa-4bad-b707-87bf84a2b923%40googlegroups.com.

Reply via email to