Ng-repeat - forcing JSONata to always return an array - when array has 1 object

Hi all I'm getting data from google calendar for my dashboard.
I'm using ng-repeat to render incoming data, here is my problem it needs more than 1 data to render correctly
here is the screenshot, when I delete one of the test event all of the template node is rendered useless :confused:

here is my setup, can someone point me to the right direction.

[{"id":"c2f0470.42c28b8","type":"tab","label":"test","disabled":false,"info":""},{"id":"edde22e8.8d64f8","type":"change","z":"c2f0470.42c28b8","name":"","rules":[{"t":"set","p":"events","pt":"msg","to":"payload.items","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":340,"wires":[["9bf4c9b0.5dc9b8"]]},{"id":"15b1e547.37bb1b","type":"ui_template","z":"c2f0470.42c28b8","group":"8f918d7.5af32f","name":"test calendar","order":7,"width":3,"height":"4","format":"<style>\n@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');   \n@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500&display=swap');\n.testebe {\n    margin:0px;\n    padding:0px;\n\toverflow:hidden;\n}\n.boxcal {\n\tbackground: #ffffff;\n\tmargin-left: 0px;\n\tmargin-top:0px;\n\tpadding-left:15px;\n\twidth: 320px;\n}\n.tepe {\n    margin-top:-12px;\n    margin-bottom:10px;\n    text-align:center;\n    background:#44647a;\n    height:90px;\n    max-width:340px\n\twidth: 340px;\n}\n.eventisim {\n    margin-top:0px;\n    margin-bottom:-5px;\n    max-width:340px\n\twidth: 340px;\n}\n.event {\n    max-width:340px\n\twidth: 340px;\n}\np.guncel {\n    padding-top:10px;\n    font-family: 'Barlow Condensed', sans-serif;\n    text-transform:uppercase;\n    font-size:54px;\n    color:#ffffff;\n}\np.pisim {\n    text-transform:uppercase;\n    font-family: 'Roboto', sans-serif;\n    font-size:30px;\n    color:#000000;\n}\np.pdesc {\n    font-family: 'Roboto', sans-serif;\n    font-size:20px;\n    color:#000000;\n}\np.ptime {\n    font-family: 'Roboto', sans-serif;\n    font-size:15px;\n    color:#000000;\n}\np.ptimeust {\n    text-transform:uppercase;\n    font-family: 'Roboto', sans-serif;\n    font-size:25px;\n    color:#000000;\n}\n\n</style>\n<div class=\"testebe\">\n<div class=\"tepe\"><p class=\"guncel\">{{msg.events[0].anlikbilgi}}</p></div>\n<div ng-repeat=\"item in msg.events\" class=\"boxcal\">\n<div class=\"eventisim\"><p class=\"pisim\"><b>{{item.summary}}</b></p></div>\n<div class=\"event\"><p class=\"ptimeust\">{{item.startDatehuman}}</p></div> \n<div class=\"event\"><p class=\"pdesc\">{{item.description}}</p></div> \n<div class=\"event\"><p class=\"ptime\">{{item.startTime}} to {{item.endTime}}</p></div> \n<hr>\n</div>\n</div>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":910,"y":340,"wires":[[]]},{"id":"9bf4c9b0.5dc9b8","type":"change","z":"c2f0470.42c28b8","name":"format events/dates","rules":[{"t":"set","p":"events","pt":"msg","to":"events.{        \"anlikbilgi\": $moment(flow.timestamphadi).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),  \"created\": $moment(created).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),       \"startDate\" : $moment(start.dateTime).tz('Europe/Istanbul').format('DD.MM.YYYY'),        \"endDate\" : $moment(end.dateTime).tz('Europe/Istanbul').format('DD.MM.YYYY'),        \"endTime\" : $moment(end.dateTime).tz('Europe/Istanbul').format('HH:mm'),        \"startTime\" : $moment(start.dateTime).tz('Europe/Istanbul').format('HH:mm'),    \"startDatehuman\" : $moment(start.dateTime).tz('Europe/Istanbul').fromNow(),      \"summary\": summary,        \"description\": description,         \"creator\": creator,        \"status\": status    }","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":340,"wires":[["15b1e547.37bb1b"]]},{"id":"1989c5cc.837be2","type":"inject","z":"c2f0470.42c28b8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"kind\":\"calendar#events\",\"etag\":\"\\\"p33c9poubjfhuu0g\\\"\",\"summary\":\"moi\",\"updated\":\"2021-04-03T23:21:30.343Z\",\"timeZone\":\"Europe/Istanbul\",\"accessRole\":\"owner\",\"defaultReminders\":[{\"method\":\"popup\",\"minutes\":10}],\"items\":[{\"kind\":\"calendar#event\",\"etag\":\"\\\"3234984150476000\\\"\",\"id\":\"_84sj0ca66p0jcb9l8d2kcb9k6h1jib9o70pkcba58kq34ci18co32ghp8o\",\"status\":\"confirmed\",\"htmlLink\":\"https://www.google.com/calendar/event?eid=Xzg0c2owY2E2NnAwamNiOWwgfgfgfgvNzBwa2NiYTU4a3EzNGNpMThjbzMyZ2hwOG8gbWFpbEBzdHVkaW9tb2kuY28\",\"created\":\"2021-04-03T23:21:15.000Z\",\"updated\":\"2021-04-03T23:21:15.238Z\",\"summary\":\"test\",\"creator\":{\"email\":\"ffffffff\",\"self\":true},\"organizer\":{\"email\":\"fffffff\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-05T19:00:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-05T20:00:00+03:00\"},\"iCalUID\":\"A901F6A6-5CEF-44C9-883F-EE422AC01B9F\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"},{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233769950762000\\\"\",\"id\":\"_8co3cgpm850k2ba268rj8b9k6ks3ab9o6so3aba48op42c1i64ojecpg60\",\"status\":\"confirmed\",\"htmlLink\":\"https://www.google.com/calendar/event?eid=XzhjbzffffJqOGI5azZrczNhYjlvNnNvM2FiYTQ4b3AggHVkaW9tb2kuY28\",\"created\":\"2021-03-27T22:37:13.000Z\",\"updated\":\"2021-03-27T22:42:55.381Z\",\"summary\":\"test2\",\"creator\":{\"email\":\"gfgfg\",\"self\":true},\"organizer\":{\"email\":\"gfgf\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-10T11:00:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-10T14:30:00+03:00\"},\"iCalUID\":\"C06C6AAA-B274-4585-8705-DF2A02117300\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"}]}","payloadType":"json","x":180,"y":340,"wires":[["edde22e8.8d64f8"]]},{"id":"c5b11326.080b8","type":"change","z":"c2f0470.42c28b8","name":"","rules":[{"t":"set","p":"events","pt":"msg","to":"payload.items","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":420,"wires":[["a1cc476e.71813"]]},{"id":"9d1083d.860c58","type":"ui_template","z":"c2f0470.42c28b8","group":"8f918d7.5af32f","name":"test calendar","order":7,"width":3,"height":"4","format":"<style>\n@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');   \n@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500&display=swap');\n.testebe {\n    margin:0px;\n    padding:0px;\n\toverflow:hidden;\n}\n.boxcal {\n\tbackground: #ffffff;\n\tmargin-left: 0px;\n\tmargin-top:0px;\n\tpadding-left:15px;\n\twidth: 320px;\n}\n.tepe {\n    margin-top:-12px;\n    margin-bottom:10px;\n    text-align:center;\n    background:#44647a;\n    height:90px;\n    max-width:340px\n\twidth: 340px;\n}\n.eventisim {\n    margin-top:0px;\n    margin-bottom:-5px;\n    max-width:340px\n\twidth: 340px;\n}\n.event {\n    max-width:340px\n\twidth: 340px;\n}\np.guncel {\n    padding-top:10px;\n    font-family: 'Barlow Condensed', sans-serif;\n    text-transform:uppercase;\n    font-size:54px;\n    color:#ffffff;\n}\np.pisim {\n    text-transform:uppercase;\n    font-family: 'Roboto', sans-serif;\n    font-size:30px;\n    color:#000000;\n}\np.pdesc {\n    font-family: 'Roboto', sans-serif;\n    font-size:20px;\n    color:#000000;\n}\np.ptime {\n    font-family: 'Roboto', sans-serif;\n    font-size:15px;\n    color:#000000;\n}\np.ptimeust {\n    text-transform:uppercase;\n    font-family: 'Roboto', sans-serif;\n    font-size:25px;\n    color:#000000;\n}\n\n</style>\n<div class=\"testebe\">\n<div class=\"tepe\"><p class=\"guncel\">{{msg.events[0].anlikbilgi}}</p></div>\n<div ng-repeat=\"item in msg.events\" class=\"boxcal\">\n<div class=\"eventisim\"><p class=\"pisim\"><b>{{item.summary}}</b></p></div>\n<div class=\"event\"><p class=\"ptimeust\">{{item.startDatehuman}}</p></div> \n<div class=\"event\"><p class=\"pdesc\">{{item.description}}</p></div> \n<div class=\"event\"><p class=\"ptime\">{{item.startTime}} to {{item.endTime}}</p></div> \n<hr>\n</div>\n</div>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":910,"y":420,"wires":[[]]},{"id":"a1cc476e.71813","type":"change","z":"c2f0470.42c28b8","name":"format events/dates","rules":[{"t":"set","p":"events","pt":"msg","to":"events.{        \"anlikbilgi\": $moment(flow.timestamphadi).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),  \"created\": $moment(created).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),       \"startDate\" : $moment(start.dateTime).tz('Europe/Istanbul').format('DD.MM.YYYY'),        \"endDate\" : $moment(end.dateTime).tz('Europe/Istanbul').format('DD.MM.YYYY'),        \"endTime\" : $moment(end.dateTime).tz('Europe/Istanbul').format('HH:mm'),        \"startTime\" : $moment(start.dateTime).tz('Europe/Istanbul').format('HH:mm'),    \"startDatehuman\" : $moment(start.dateTime).tz('Europe/Istanbul').fromNow(),      \"summary\": summary,        \"description\": description,         \"creator\": creator,        \"status\": status    }","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":420,"wires":[["9d1083d.860c58"]]},{"id":"bc7d2308.a7e018","type":"inject","z":"c2f0470.42c28b8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"kind\":\"calendar#events\",\"etag\":\"\\\"p32g898uaefemnhuu0g\\\"\",\"summary\":\"moffi\",\"updated\":\"2021-04-04T01:17:46.516Z\",\"timeZone\":\"Europe/Istanbul\",\"accessRole\":\"owner\",\"defaultReminders\":[{\"method\":\"popup\",\"minutes\":10}],\"items\":[{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233769950762000\\\"\",\"id\":\"_8cfefefef6ks3ab9o6so3aba48op42c1i64ojecpg60\",\"status\":\"confirmed\",\"htmlLink\":\"https://www.google.com/calendar/event?eid=XzhefefefvM2fFiYfffffTQ4b3A0Mmfdfdfdf0b2plY3BnNjAgbWFpbEhhhBzdHVkaW9tb2kuY28\",\"created\":\"2021-03-27T22:37:13.000Z\",\"updated\":\"2021-03-27T22:42:55.381Z\",\"summary\":\"test only one\",\"creator\":{\"email\":\"fdfd\",\"self\":true},\"organizer\":{\"email\":\"fdfd\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-10T11:00:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-10T14:30:00+03:00\"},\"iCalUID\":\"C06C6Adfdf5-DF2A02117300\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"}]}","payloadType":"json","x":180,"y":420,"wires":[["c5b11326.080b8"]]},{"id":"8f918d7.5af32f","type":"ui_group","name":"all","tab":"c1dcfb03.ffed9","order":5,"disp":false,"width":14,"collapse":false},{"id":"c1dcfb03.ffed9","type":"ui_tab","name":"dash","icon":"dashboard","order":1}]

Hi Umtksa,

If you add complete message debug nodes after both of your Jsonata you will notice that in the case where the jsonata query returns a single element it doesnt put the result in an array.
So the "issue" is not so much with ng-repeat. ng-repeat doesnt know what to do with an object since it expects an array.

One way around it is to force jsonata to add the single object result in an array regardless with the $append() command.

$append( [],
events.{
   "anlikbilgi": $moment(flow.timestamphadi).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),
   "created": $moment(created).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),
   "startDate" : $moment(start.dateTime).tz('Europe/Istanbul').format('DD.MM.YYYY'),
   "endDate" : $moment(end.dateTime).tz('Europe/Istanbul').format('DD.MM.YYYY'),
   "endTime" : $moment(end.dateTime).tz('Europe/Istanbul').format('HH:mm'),
   "startTime" : $moment(start.dateTime).tz('Europe/Istanbul').format('HH:mm'),
   "startDatehuman" : $moment(start.dateTime).tz('Europe/Istanbul').fromNow(),
   "summary": summary,
   "description": description,
   "creator": creator,
   "status": status    
})

It was discussed on the jsonata github page if you want to read more about it.
... does not return an array if no or only one item matches

Test flow :

[{"id":"edde22e8.8d64f8","type":"change","z":"c2f0470.42c28b8","name":"","rules":[{"t":"set","p":"events","pt":"msg","to":"payload.items","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":340,"wires":[["9bf4c9b0.5dc9b8"]]},{"id":"15b1e547.37bb1b","type":"ui_template","z":"c2f0470.42c28b8","group":"8f918d7.5af32f","name":"test calendar","order":7,"width":"14","height":"9","format":"<style>\n@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');   \n@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500&display=swap');\n.testebe {\n    margin:0px;\n    padding:0px;\n\toverflow:hidden;\n}\n.boxcal {\n\tbackground: #ffffff;\n\tmargin-left: 0px;\n\tmargin-top:0px;\n\tpadding-left:15px;\n\twidth: 320px;\n}\n.tepe {\n    margin-top:-12px;\n    margin-bottom:10px;\n    text-align:center;\n    background:#44647a;\n    height:90px;\n    max-width:340px\n\twidth: 340px;\n}\n.eventisim {\n    margin-top:0px;\n    margin-bottom:-5px;\n    max-width:340px\n\twidth: 340px;\n}\n.event {\n    max-width:340px\n\twidth: 340px;\n}\np.guncel {\n    padding-top:10px;\n    font-family: 'Barlow Condensed', sans-serif;\n    text-transform:uppercase;\n    font-size:54px;\n    color:#ffffff;\n}\np.pisim {\n    text-transform:uppercase;\n    font-family: 'Roboto', sans-serif;\n    font-size:30px;\n    color:#000000;\n}\np.pdesc {\n    font-family: 'Roboto', sans-serif;\n    font-size:20px;\n    color:#000000;\n}\np.ptime {\n    font-family: 'Roboto', sans-serif;\n    font-size:15px;\n    color:#000000;\n}\np.ptimeust {\n    text-transform:uppercase;\n    font-family: 'Roboto', sans-serif;\n    font-size:25px;\n    color:#000000;\n}\n\n</style>\n<div class=\"testebe\">\n<div class=\"tepe\"><p class=\"guncel\">{{msg.events[0].anlikbilgi}}</p></div>\n<div ng-repeat=\"item in msg.events\" class=\"boxcal\">\n<div class=\"eventisim\"><p class=\"pisim\"><b>{{item.summary}}</b></p></div>\n<div class=\"event\"><p class=\"ptimeust\">{{item.startDatehuman}}</p></div> \n<div class=\"event\"><p class=\"pdesc\">{{item.description}}</p></div> \n<div class=\"event\"><p class=\"ptime\">{{item.startTime}} to {{item.endTime}}</p></div> \n<hr>\n</div>\n</div>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":910,"y":340,"wires":[[]]},{"id":"9bf4c9b0.5dc9b8","type":"change","z":"c2f0470.42c28b8","name":"format events/dates","rules":[{"t":"set","p":"events","pt":"msg","to":"$append( [],\tevents.{\t   \"anlikbilgi\": $moment(flow.timestamphadi).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),\t   \"created\": $moment(created).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),\t   \"startDate\" : $moment(start.dateTime).tz('Europe/Istanbul').format('DD.MM.YYYY'),\t   \"endDate\" : $moment(end.dateTime).tz('Europe/Istanbul').format('DD.MM.YYYY'),\t   \"endTime\" : $moment(end.dateTime).tz('Europe/Istanbul').format('HH:mm'),\t   \"startTime\" : $moment(start.dateTime).tz('Europe/Istanbul').format('HH:mm'),\t   \"startDatehuman\" : $moment(start.dateTime).tz('Europe/Istanbul').fromNow(),\t   \"summary\": summary,\t   \"description\": description,\t   \"creator\": creator,\t   \"status\": status    \t})","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":340,"wires":[["15b1e547.37bb1b","8b96cd32.4e24d"]]},{"id":"1989c5cc.837be2","type":"inject","z":"c2f0470.42c28b8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"kind\":\"calendar#events\",\"etag\":\"\\\"p33c9poubjfhuu0g\\\"\",\"summary\":\"moi\",\"updated\":\"2021-04-03T23:21:30.343Z\",\"timeZone\":\"Europe/Istanbul\",\"accessRole\":\"owner\",\"defaultReminders\":[{\"method\":\"popup\",\"minutes\":10}],\"items\":[{\"kind\":\"calendar#event\",\"etag\":\"\\\"3234984150476000\\\"\",\"id\":\"_84sj0ca66p0jcb9l8d2kcb9k6h1jib9o70pkcba58kq34ci18co32ghp8o\",\"status\":\"confirmed\",\"htmlLink\":\"https://www.google.com/calendar/event?eid=Xzg0c2owY2E2NnAwamNiOWwgfgfgfgvNzBwa2NiYTU4a3EzNGNpMThjbzMyZ2hwOG8gbWFpbEBzdHVkaW9tb2kuY28\",\"created\":\"2021-04-03T23:21:15.000Z\",\"updated\":\"2021-04-03T23:21:15.238Z\",\"summary\":\"test\",\"creator\":{\"email\":\"ffffffff\",\"self\":true},\"organizer\":{\"email\":\"fffffff\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-05T19:00:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-05T20:00:00+03:00\"},\"iCalUID\":\"A901F6A6-5CEF-44C9-883F-EE422AC01B9F\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"},{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233769950762000\\\"\",\"id\":\"_8co3cgpm850k2ba268rj8b9k6ks3ab9o6so3aba48op42c1i64ojecpg60\",\"status\":\"confirmed\",\"htmlLink\":\"https://www.google.com/calendar/event?eid=XzhjbzffffJqOGI5azZrczNhYjlvNnNvM2FiYTQ4b3AggHVkaW9tb2kuY28\",\"created\":\"2021-03-27T22:37:13.000Z\",\"updated\":\"2021-03-27T22:42:55.381Z\",\"summary\":\"test2\",\"creator\":{\"email\":\"gfgfg\",\"self\":true},\"organizer\":{\"email\":\"gfgf\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-10T11:00:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-10T14:30:00+03:00\"},\"iCalUID\":\"C06C6AAA-B274-4585-8705-DF2A02117300\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"}]}","payloadType":"json","x":180,"y":340,"wires":[["edde22e8.8d64f8"]]},{"id":"c5b11326.080b8","type":"change","z":"c2f0470.42c28b8","name":"","rules":[{"t":"set","p":"events","pt":"msg","to":"payload.items","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":420,"wires":[["a1cc476e.71813"]]},{"id":"9d1083d.860c58","type":"ui_template","z":"c2f0470.42c28b8","group":"","name":"test calendar","order":7,"width":"14","height":"7","format":"<style>\n@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');   \n@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500&display=swap');\n.testebe {\n    margin:0px;\n    padding:0px;\n\toverflow:hidden;\n}\n.boxcal {\n\tbackground: #ffffff;\n\tmargin-left: 0px;\n\tmargin-top:0px;\n\tpadding-left:15px;\n\twidth: 320px;\n}\n.tepe {\n    margin-top:-12px;\n    margin-bottom:10px;\n    text-align:center;\n    background:#44647a;\n    height:90px;\n    max-width:340px\n\twidth: 340px;\n}\n.eventisim {\n    margin-top:0px;\n    margin-bottom:-5px;\n    max-width:340px\n\twidth: 340px;\n}\n.event {\n    max-width:340px\n\twidth: 340px;\n}\np.guncel {\n    padding-top:10px;\n    font-family: 'Barlow Condensed', sans-serif;\n    text-transform:uppercase;\n    font-size:54px;\n    color:#ffffff;\n}\np.pisim {\n    text-transform:uppercase;\n    font-family: 'Roboto', sans-serif;\n    font-size:30px;\n    color:#000000;\n}\np.pdesc {\n    font-family: 'Roboto', sans-serif;\n    font-size:20px;\n    color:#000000;\n}\np.ptime {\n    font-family: 'Roboto', sans-serif;\n    font-size:15px;\n    color:#000000;\n}\np.ptimeust {\n    text-transform:uppercase;\n    font-family: 'Roboto', sans-serif;\n    font-size:25px;\n    color:#000000;\n}\n\n</style>\n<div class=\"testebe\">\n<div class=\"tepe\"><p class=\"guncel\">{{msg.events[0].anlikbilgi}}</p></div>\n<div ng-repeat=\"item in msg.events\" class=\"boxcal\">\n<div class=\"eventisim\"><p class=\"pisim\"><b>{{item.summary}}</b></p></div>\n<div class=\"event\"><p class=\"ptimeust\">{{item.startDatehuman}}</p></div> \n<div class=\"event\"><p class=\"pdesc\">{{item.description}}</p></div> \n<div class=\"event\"><p class=\"ptime\">{{item.startTime}} to {{item.endTime}}</p></div> \n<hr>\n</div>\n</div>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":910,"y":420,"wires":[[]]},{"id":"a1cc476e.71813","type":"change","z":"c2f0470.42c28b8","name":"format events/dates","rules":[{"t":"set","p":"events","pt":"msg","to":"$append( [],\tevents.{\t   \"anlikbilgi\": $moment(flow.timestamphadi).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),\t   \"created\": $moment(created).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),\t   \"startDate\" : $moment(start.dateTime).tz('Europe/Istanbul').format('DD.MM.YYYY'),\t   \"endDate\" : $moment(end.dateTime).tz('Europe/Istanbul').format('DD.MM.YYYY'),\t   \"endTime\" : $moment(end.dateTime).tz('Europe/Istanbul').format('HH:mm'),\t   \"startTime\" : $moment(start.dateTime).tz('Europe/Istanbul').format('HH:mm'),\t   \"startDatehuman\" : $moment(start.dateTime).tz('Europe/Istanbul').fromNow(),\t   \"summary\": summary,\t   \"description\": description,\t   \"creator\": creator,\t   \"status\": status    \t})","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":420,"wires":[["9d1083d.860c58","c97edd7f.749ba"]]},{"id":"bc7d2308.a7e018","type":"inject","z":"c2f0470.42c28b8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"kind\":\"calendar#events\",\"etag\":\"\\\"p32g898uaefemnhuu0g\\\"\",\"summary\":\"moffi\",\"updated\":\"2021-04-04T01:17:46.516Z\",\"timeZone\":\"Europe/Istanbul\",\"accessRole\":\"owner\",\"defaultReminders\":[{\"method\":\"popup\",\"minutes\":10}],\"items\":[{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233769950762000\\\"\",\"id\":\"_8cfefefef6ks3ab9o6so3aba48op42c1i64ojecpg60\",\"status\":\"confirmed\",\"htmlLink\":\"https://www.google.com/calendar/event?eid=XzhefefefvM2fFiYfffffTQ4b3A0Mmfdfdfdf0b2plY3BnNjAgbWFpbEhhhBzdHVkaW9tb2kuY28\",\"created\":\"2021-03-27T22:37:13.000Z\",\"updated\":\"2021-03-27T22:42:55.381Z\",\"summary\":\"test only one\",\"creator\":{\"email\":\"fdfd\",\"self\":true},\"organizer\":{\"email\":\"fdfd\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-10T11:00:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-10T14:30:00+03:00\"},\"iCalUID\":\"C06C6Adfdf5-DF2A02117300\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"}]}","payloadType":"json","x":180,"y":420,"wires":[["c5b11326.080b8"]]},{"id":"8b96cd32.4e24d","type":"debug","z":"c2f0470.42c28b8","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":820,"y":240,"wires":[]},{"id":"c97edd7f.749ba","type":"debug","z":"c2f0470.42c28b8","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830,"y":520,"wires":[]},{"id":"8f918d7.5af32f","type":"ui_group","name":"all","tab":"c1dcfb03.ffed9","order":5,"disp":false,"width":14,"collapse":false},{"id":"c1dcfb03.ffed9","type":"ui_tab","name":"dash","icon":"dashboard","order":1}]

[EDIT]
Correction .. i think $append may not be needed after all. Just wrap your Jsonata expression with square brackets and that should give the same result [ events.{ ... } ] . To basically force the result to be an array even if its a single obj.

3 Likes

yep it's working :v:
thank you for that fast reply and extra explanations about this situation
edit: I've also edited title to be more informative

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.