Change an array in a function

Still don't understand what you are trying to achieve...
You want to modify the service:Database while keeping the order of the array the same (or something) ?

In your map example does not exist. it should be obj.mactive
This works

a = [{"service": "Check server", "service_status" : false,"paralel":false, "time": null, "st_info":true, "st_debug":false, "mresult":null,"mactive":true},
            {"service": "Database", "service_status" : false,"paralel":true, "time": null,"st_info":true, "st_debug":true,"mresult":null,"mactive":false},
            {"service": "Notificatie", "service_status" : false,"paralel":true, "time": null,"st_info":true, "st_debug":true,"mresult":null,"mactive":true},
            {"service": "OS command", "service_status" : false,"paralel":false, "time": null,"st_info":true, "st_debug":true,"mresult":null,"mactive":false}];

let s = "Database"
let r = null => {
   if(obj.service === s) { obj.mactive = true;r = obj}
   return obj 

node.warn('changed array: '+JSON.stringify(a))

if(r !== null)
    {msg.payload = r;return msg;}

Yes, modqueue is an working execution plan, for executing submodules. During the execution, a part of the modules that must be executed can be changed. So i needed a way to update content of that execution plan. Thats updating modqueue.. It works like a charm... And yes i saw the type error mactive/active.. i was playing around with other values.

My original loop version works ok, the new .map version is much shorter and i changed it already...
So i learned new functionality with this challenge, so thank you all...

jsonata is another thing i never used, so i have to try that too

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