Summation of fields based on criteria

Hi,

if i have 4 tiddlers with the following fields

tiddler 4 with the following fields
title = tiddler 4
Childof = tiddler 3
effort = 1

tiddler 3 with the following fields
title = tiddler 3
Childof = tiddler 2
effort = 1

tiddler 2 with the following field
title = tiddler 2
Childof = tiddler 1
effort = 1

tiddler 1 with the following field
title = tiddler 1
Childof = null
effort = null

how can i create button to do the following

-Find all tiddlers that have in the “childof” field a value matching the title of an existing tiddler
-Fetch the values in the “effort” field for said tiddlers and add them up
-then finally update the “effort” field in the tiddler that has a matching title with the total sum

Background

I have been trying for a while to put together a tracker that could help me organize tasks.

while there are many options available , i decided to do one for my own, using my 0 coding skills

with the help of many members in the forum , and some scraping from previous posts. i was able to make a simple tracker , that can display a parent child relation ship .

the parent child relation ship is established by holding the name of the parent task in a field i called “childof” in the child tiddler , which automatically populates whenever a child is created from the belly of master task .

Master tasks have in their “status” field the value “Master” , whereas all child tiddlers have a variety of status , " inhouse" , “pending” etc …

each tiddler is assigned a value in the “effort” field indicating how long it would take to finish

My problem is how do i create a button, to add up all values in the effort field in all child tiddlers to show up as a total in the their master

i cant upload the file due to restrictions (understandably)on the forum for new users :confused:

To make a button that can be added to any “master” tiddler, you could put the following macro definition in a tiddler tagged with $:/tags/Macro, like this:

\define getTotal()
<$button> get total effort
   <$action-setfield total={{{ [all[tiddlers]childof<currentTiddler>get[effort]sum[]] }}}/>
</$button>
\end

Then, you can just write: <<getTotal>> in any “master” tiddler.

thank you very much Eric