Copy link to clipboard
Copied
So basically I am trying to select each of my channels in order and complete a set of tasks on each. I want to be able to specify which channels are acted on, so I already have an array of my selected channels, but when I try to run the loop, it says that the "activeChannels =" needs an array.
I know that my channelNumber array is good, but I cant figure out how to make this loop work.
Here is my for loop:
for (var i=0;i<channelNumber.length;i++){
doc.activeChannels = channelNumber;
//do some stuff
}
I actually just figured it out. When i declared my channelNumber variable i just declared "channelNumber = new Array(doc.activeChannels)" instead of "channelNumber = doc.activeChannels" and it worked fine. Seems silly for it not to accept a single channel.
Copy link to clipboard
Copied
Does
doc.activeChannels = [channelNumber];
work?
Copy link to clipboard
Copied
I actually just figured it out. When i declared my channelNumber variable i just declared "channelNumber = new Array(doc.activeChannels)" instead of "channelNumber = doc.activeChannels" and it worked fine. Seems silly for it not to accept a single channel.
Copy link to clipboard
Copied
Seems silly for it not to accept a single channel.
I guess that depends on how you look at it. It is named activeClannels not activeChannel. And it doesn't really accept multiple channels either. It accepts one argument which must be an array. It is true the array must have valid channel objects as it elements but it accepts one channel the same way it accepts multiple channels - as elements of the array argument.