DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Move method for data working on some installations and not others

Solved!
Go to solution

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.

0 Kudos
Message 1 of 4
(1,942 Views)
Solution
Accepted by topic author Simon_Aldworth

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

0 Kudos
Message 2 of 4
(1,843 Views)

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. 

0 Kudos
Message 3 of 4
(1,810 Views)

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.

0 Kudos
Message 4 of 4
(1,769 Views)