The easiest way to find out the reason is to add two IQ Input widgets to your HMI and setting the items to Dialog.ArrayIndex and MSGArray0.MSGName (or any other one used). Then you can see if your input and output items have the correct values. Also have a look at the browser console (F12) if any corresponding error is shown. Your main function code can by the way be simplified into this: module.run = function (self) { const im = shmi.visuals.session.ItemManager; // Everything in WebIQ happens asynchronously so you always have to use callbacks // Please keep in mind that your code can only retrieve item values by either subscribing to them or reading them directly // Please note: if any of the items used are virtual items the corresponding code would have to be changed im.readDirect(["Dialog.ArrayIndex", "MSGArray0.MSGName", "MSGArray1.MSGName", "MSGArray2.MSGName", "MSGArray3.MSGName", "MSGArray4.MSGName"], function(err, result) { if (!err) { const idx = result["Dialog.ArrayIndex"]; if (idx >= 0 && idx <= 4) { im.writeDirect({"Dialog.MSGName": result["MSGArray" + idx + ".MSGName"]}, function(err, result) { if (err) { console.error("Error occurred writing item: "+err); showMessageOnCompleted(false); } else showMessageOnCompleted(true); }); } } else { console.log("Could not read items: ", err, result); showMessageOnCompleted(false); } }); /* called when this local-script is disabled */ self.onDisable = function () { self.run = false; /* from original .onDisable function of LocalScript control */ }; }; // MODULE CODE - END fLog("module loaded"); })();
... View more