DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Replacing ChnValMax

Solved!
Go to solution

Hi,

The following line of code will soon fail once ChnValMax disappears having become obsolete:

Dim HWChn: HWChn =  "[1]/HW Angle"
L1 = Find("Ch(""" & HWChn & """) = ChnValMax(""" & HWChn & """)")

To find the maximum values of a channel the help files instruct me to use something like:

Data.Root.ChannelGroups(1).Channels(2).Maximum

This seems terribly long-winded, and since I'm going to refer to the same channel frequently, I have tried to assign a channel to a variable using GetChannel (the first line of code is dummy just to make the point):

T1 = "[1]/HW Angle"
Set HWChn = Data.GetChannel(T1)

 Having implemented this I found the following code works fine:

L1 = Find("Ch(""" & T1 & """) = " & HWChn.Maximum)

 But, can I do better? The use of T1 and all the quotations marks is ugly, so can I use the variable HWChn for the channel reference in the first part of my Find condition?

 

Thanks, Simon.

0 Kudos
Message 1 of 2
(2,226 Views)
Solution
Accepted by topic author Simon_Aldworth

Hi All,

 

I believe I answered a similar question in the following sibling post:

 

https://forums.ni.com/t5/DIAdem/Channel-references-in-functions/m-p/4014309#M27160

 

Brad Turpin

Senior Technical Support Engineer

National Instruments

0 Kudos
Message 2 of 2
(2,172 Views)