I’m writing a script that creates a tag.Warning if at least one of the Device.Routing.Router.1.IPv4Forwarding.*.Status parameters is not enabled.
I used a Try Catch because I don’t know what parameters exist or not.
But it doesn’t work if I don’t put the creation of a useless parameter in the Catch
declare(“Tags.Checked”, null, {value: true});
There has to be a way to do it.
let Contatore=0;
let Errori=0;
for (let i = 1; i < 250; ++i)
{
try {
//declare(“Tags.TestOk” + i, null,{value: true});
let status = declare(“Device.Routing.Router.1.IPv4Forwarding.” + i + “.Status”, {value: 1}).value[0];
if (status !== “Enabled”) {
Contatore=Contatore+1;
//declare(“Tags.Test” + i + status, null,{value: true});
}
if (Contatore>0){
declare(“Tags.Warning”, null, {value: true});
}
} catch (err) {
declare("Tags.Checked", null, {value: true});
}
}