Hi everyone, I have a Set node that is giving me a bunch of useful Timesheet data. In the various items that it outputs, it’s given me one that is called “Phase ID”.
This Phase ID repeats multiple times throughout the data and each time it has a unique time associated with it. My goal is to summarise the times that are associated with each unique Phase ID so I can figure out how much is the total time spent on each unique Phase ID.
The time is decimal so makes it simpler but I can’t figure out a way to get n8n to sum this data based on this condition.
I tried ChatGPT’s Javascripts a few times but wasn’t able to get it to work because I don’t know Javascript.
Could you guys assist me in achieving this result? I know it’s doable but after 2 months of playing around with the issue, I’ve hit a brick wall that I can’t pass.
The ideal result from the example data below would be:
“Phase ID”:3583999620112069,
“Timesheet Entry”:1.25,
“Phase ID”:3583987520112107,
“Timesheet Entry”:5.15,
“Phase ID”:3583987020112549,
“Timesheet Entry”:0.5,
Example Data:
[
{
“Timesheet Entry”:1.25,
“Task Billable Rate”:“$”,
“Cost Rate”:“$80”,
“Project ID”:35839996,
“Budget”:“$”,
“Person Billable Rate”:“$140”,
“Task ID”:20112069,
“Phase ID”:3583999620112069,
“Date”:“2023-03-10T01:37:24Z”,
“Project Name”:“3/3A Newlands Road, Reservoir”,
“Project Code”:8008,
“Task Name”:“05 Construction Documents”
},
{
“Timesheet Entry”:2.67,
“Task Billable Rate”:“$”,
“Cost Rate”:“$80”,
“Project ID”:35839875,
“Budget”:“$”,
“Person Billable Rate”:“$140”,
“Task ID”:20112107,
“Phase ID”:3583987520112107,
“Date”:“2023-03-10T01:35:32Z”,
“Project Name”:“21 Wright Road, Keilor Park”,
“Project Code”:7817,
“Task Name”:“05 Construction Documents - Services”
},
{
“Timesheet Entry”:0.5,
“Task Billable Rate”:“$”,
“Cost Rate”:“$80”,
“Project ID”:35839870,
“Budget”:“$”,
“Person Billable Rate”:“$140”,
“Task ID”:20112549,
“Phase ID”:3583987020112549,
“Date”:“2023-03-10T01:14:25Z”,
“Project Name”:“Brighton Ineos”,
“Project Code”:7804,
“Task Name”:“07 Contract Administration - Services”
},
{
“Timesheet Entry”:2.5,
“Task Billable Rate”:“$”,
“Cost Rate”:“$80”,
“Project ID”:35839875,
“Budget”:“$”,
“Person Billable Rate”:“$140”,
“Task ID”:20112107,
“Phase ID”:3583987520112107,
“Date”:“2023-03-10T01:09:28Z”,
“Project Name”:“21 Wright Road, Keilor Park”,
“Project Code”:7817,
“Task Name”:“05 Construction Documents - Services”
},
]