Change node only returning first object

I am having big problem with the change node and JSONata this morning (first time I use it). I get the JSONata expression to work just fine if I run it in the debug node or using the test in the change node. But whatever I do when running it, it just returns the first object from the input. No formatting is done what so ever...

These are my nodes:

[{"id":"d1b75b09.98ccf","type":"inject","z":"21ba8344.84d7ec","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":105,"y":280,"wires":[["d5268ad8.fccf4"]]},{"id":"d5268ad8.fccf4","type":"nordpool-api","z":"21ba8344.84d7ec","name":"","area":"SE3","currency":"SEK","x":290,"y":280,"wires":[["98f232b7.7c20b"]]},{"id":"98f232b7.7c20b","type":"change","z":"21ba8344.84d7ec","name":"ConvertToChart","rules":[{"t":"set","p":"","pt":"msg","to":"{\t \"payload\": \t {\t \"series\": [\"SEK/MWh\"],\t \"labels\": [\"\"],\t \"data\": $$.[\t {\t \"x\": Timestamp,\t \"y\": $number(Price)\t }\t ]\t }\t}\t ","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":280,"wires":[["f17df13b.dfd648"]]},{"id":"f17df13b.dfd648","type":"debug","z":"21ba8344.84d7ec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":280,"wires":[]}]

What I want to do in the end is to show the prices returned from Nordpool in a dashboard chart, but I have not come that far since the output from the change node is just not working as I want to...

Any help would be gratefully appreciated!

Please see this post on how to share a flow. Then edit your previous post. Then we will be able to import your flow.

Put a debug node (set to display the complete msg object) on the output of the nordpool-api node so we can see the data

The nordpool-api node is returning a badly formatted message, as discussed in this active topic: JSONata and arrays in root of msg

Someone needs to contact the author and get them to fix it

Try again with the very recently updated (tonight) nordpool-api node with a different output.

Got it to work with the new nordpool-api :slight_smile: Thanks!

Still having some chart display issues. I get single dots in different colors and no connecting lines in between. How can I fix that?

The nodes look like this:

[{"id":"d1b75b09.98ccf","type":"inject","z":"21ba8344.84d7ec","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":105,"y":280,"wires":[["d5268ad8.fccf4"]]},{"id":"d5268ad8.fccf4","type":"nordpool-api","z":"21ba8344.84d7ec","name":"","area":"SE3","currency":"SEK","x":290,"y":280,"wires":[["98f232b7.7c20b","de4f6d45.09fda"]]},{"id":"98f232b7.7c20b","type":"change","z":"21ba8344.84d7ec","name":"ConvertToChart","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\t   \"series\": payload.[\"SE3\"],\t   \"labels\": [\"\"],\t   \"data\": payload.[\t       {\t           \"x\": Timestamp,\t           \"y\": $round($number(Price)/10, 2)\t   }]\t}]\t ","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":280,"wires":[["e26f0d1e.3689f8","a44a3524.ac3a58"]]},{"id":"a44a3524.ac3a58","type":"ui_chart","z":"21ba8344.84d7ec","name":"","group":"906ffc17.f7c968","order":0,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":710,"y":280,"wires":[[]]},{"id":"906ffc17.f7c968","type":"ui_group","z":"","name":"Elpris (Nordpool, SE3)","tab":"9f762a9.3aa0558","order":1,"disp":true,"width":"6","collapse":false},{"id":"9f762a9.3aa0558","type":"ui_tab","z":"","name":"Status","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

And the data sent to the chart looks like this:

{"payload":[{"series":[["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"],["SE3"]],"labels":[""],"data":[[{"x":"2019-11-18 00:00","y":40.42}],[{"x":"2019-11-18 01:00","y":39.69}],[{"x":"2019-11-18 02:00","y":39.23}],[{"x":"2019-11-18 03:00","y":39.3}],[{"x":"2019-11-18 04:00","y":41.21}],[{"x":"2019-11-18 05:00","y":42.53}],[{"x":"2019-11-18 06:00","y":44.06}],[{"x":"2019-11-18 07:00","y":45.98}],[{"x":"2019-11-18 08:00","y":47.32}],[{"x":"2019-11-18 09:00","y":47.84}],[{"x":"2019-11-18 10:00","y":47.38}],[{"x":"2019-11-18 11:00","y":46.86}],[{"x":"2019-11-18 12:00","y":46.67}],[{"x":"2019-11-18 13:00","y":46.43}],[{"x":"2019-11-18 14:00","y":46.46}],[{"x":"2019-11-18 15:00","y":46.65}],[{"x":"2019-11-18 16:00","y":47.38}],[{"x":"2019-11-18 17:00","y":47.26}],[{"x":"2019-11-18 18:00","y":45.94}],[{"x":"2019-11-18 19:00","y":44.36}],[{"x":"2019-11-18 20:00","y":43.38}],[{"x":"2019-11-18 21:00","y":43.03}],[{"x":"2019-11-18 22:00","y":42.22}],[{"x":"2019-11-18 23:00","y":39.55}]]}],"_msgid":"cf2843f4.a6674"}

What needs to be fixed?