"Cannot read property 'sum:' of undefined"

Hello there,

when using a Change/Set function on a certain message I get the error mentioned in the title.
I am using Node Red in Siemens Mindsphere environment.
The object is looking like this:

5.11.2019, 22:11:09.975node: 3ce216b3.c1054a
7c14dc0b6f2448caa676cd67a4626e47/Siwa_Fridge_Aspect/Coca_Cola_L: msg: Object
object
Coca_Cola_L_qc: object
_type: "number"
minvalue: 0
maxvalue: 0
count: 1
sum: 0
average: 0
Coca_Cola_L: object
_type: "number"
minvalue: 18
maxvalue: 18
count: 1
sum: 18
average: 18

The change function was taken from the palette. I used the debug "copy path" function to pick the values path and use it in the change function with the set operation -- sio, I followed pretty much the user guide.

Any idea what to do here?

Thank you in advance,
Konstantin

the property name would just be sum not sum:
: is used as the separator between the property name and its value sum : 0

If that doesn't fix it show us how you have configured the change node.

Hi,
Thanks for the feedback so far. Removing the ":" does not change the behaviour, the error message is:

"Cannot read property 'sum' of undefined"

The change node is looking very basic:
image

As mentioned, I just took the Debug "copy path" function and put this into the change node.

Cheers
Konstantin

Is it possible that a message with a different format is arriving at that Change node? Do you still have a Debug node alongside the Change node so you can verify exactly what is being passed into it when you see the error?

The flow is looking like that:

The debug node is directly connected to the "read aggregates" node. The payload at the debug node is what I posted in my initial post.
The error is created from the change node.
At the change node output the payload remains unchanged -- so it is exactly what the "read aggregates" node delivers.

if this is your msg.payload than try this:

msg.payload.Coca_Cola_L.sum

@cflurin -- that helped! Getting the right value now.
Strange that the copy function is not picking the path properly

Thank you very much!