I'm assuming that the "IMMediaTV Live" is what is changing in each of your buttons. If that assumption is wrong, then adjust the code based on what is really changing.
You have several options:
Option 1: if statements:
if (params.getValue('buttonArray', 0) == 1) {
nkglobal.getScriptObject("NK_IPS.1").doSwitchWithL abels("QC Monitor", "IMMediaTV Live", 1);
}
if (params.getValue("buttonArray', 0) == 2) {
nkglobal.getScriptObject("NK_IPS.1").doSwitchWithL abels("QC Monitor", "Something Else", 1);
}
...
Option 2: switch
switch(params.getValue('buttonArray',0)) {
case 1:
nkglobal.getScriptObject("NK_IPS.1").doSwitchWithL abels("QC Monitor", "IMMediaTV Live", 1);
break;
case 2:
nkglobal.getScriptObject("NK_IPS.1").doSwitchWithL abels("QC Monitor", "Something Else", 1);
break;
case 3:
nkglobal.getScriptObject("NK_IPS.1").doSwitchWithL abels("QC Monitor", "Something Else Again", 1);
break;
default:
code block
}
Option 3: Use your constraint values to dictate what happens:
Change your task to this:
nkglobal.getScriptObject("NK_IPS.1").doSwitchWithL abels("QC Monitor", params.getValueAsString("buttonArray",0), 1);
The getValueAsString will get you the name of the button. As long as you setup the constraint with the right names, then the SwitchWithLabels will work fine.
I much prefer option 3, but I'm not sure what the other 7 buttons are doing. If they are all doing the same thing, but with one small change, then I would use option 3. If each of the buttons is doing something radically different, I would go with option 2.
It also looks like you are using Visual Logic.
There are VL blocks for if and switch statements too.
You can also find the block for the "buttonArray" parameter and attach it to the "doSwitchWithLabels" block that you are using. I don't have an NK router in my current network, so I can't show you an example. But that block should have several inputs, you can use the parameter value as one of those inputs. I'm using a Carbonite "set source mnemonic" block as an example of what it would look like:

#DashBoard