06-10-2020 09:57 AM
Hi,
A colleague of mine is receiving a script error message relating to the move method for data, but the same script works fine on my machine.
The line is:
Call Data.Move(Data.Root.ChannelGroups(1).Channels("HW_Strat"),Data.Root.ChannelGroups(1).Channels(7))
His error message is:
Error in Move method: For Channel type elements, the target object must be a Channels collection.
This doesn't seem right to me, not just because it works on my machine (and others in the team), but because the help files state that it's OK to use a single channel identifier.
We're both running 2019 on Windows 10.
Does anyone have any ideas?
Regards,
Simon.
Solved! Go to Solution.
07-03-2020 11:45 AM
Hi Simon,
I haven't ever used the Move method that way, I've always used a target channel collection and a position index if needed. But I agree passing a target channel is in the Help system, and I just tried it in DIAdem 2020 and it worked fine.
So I agree that it's a mystery why this works on some computers and not others. I will suggest this as a way to hopefully narrow down the problem source-- unbundle your nested commands to see which one is really causing trouble:
Set FromChannel = Data.Root.ChannelGroups(1).Channels("HW_Strat")
Set ToChannel = Data.Root.ChannelGroups(1).Channels(7)
Call Data.Move(FromChannel, ToChannel)
Brad Turpin
Principal Technical Support Engineer
National Instruments
07-08-2020 05:29 AM
Hi Brad,
I used the code you gave below and the problem still occurs. It fails on the Move call again but rather than chase it further I re-wrote the code using:
Set FromChannel = Data.Root.ChannelGroups(1).Channels("HW_Strat")
Set ToChannel = Data.Root.ChannelGroups(1).Channels
Call Data.Move(FromChannel, ToChannel, 😎
Which is I think what you were suggesting as your preferred method. This works fine.
I guess we'll never know why one version of the application accepts the original code and another doesn't.
Regards,
Simon.
07-29-2020 05:20 AM
I've just spotted the incomplete code - it's missing the index in the Move call. To be clear, the code should read:
Set FromChannel = Data.Root.ChannelGroups(1).Channels("HW_Strat")
Set ToChannel = Data.Root.ChannelGroups(1).Channels
Call Data.Move(FromChannel, ToChannel, 😎
Regards.