ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Search if Channels Exist

Running a script over many different versions of data logged, and the problem I'm having is finding channel names.  I run a report after crunching the data, but what happens is for instance in an older version I have a channel named

"Exhaust_Press"
and in the newer version I have a new channel named

"Exhaust_Press_Est" 

 

I want to determine if a channel doesn't exist, then use a different channel, if no channels exist of the type I want then to make a default channel.  Something like:

 

if isexist("Exhaust_Press") = 1 then

%process data

else if isexist("Exhaust_Press_Est") = 1 then

%process data

else

Exhaust_Press = ones(1:100)

end

 

Anybody have a clue how to do this in DIADem??

0 Kudos
Message 1 of 3
(5,125 Views)

Have you tried the CNo function? If a channel exists I believe it returns a value >=1 depending on its position in the dataportal else it returns 0.

 

Hope that helps.

 

Matthew

0 Kudos
Message 2 of 3
(5,111 Views)
If Data.Root.ChannelGroups("GroupName").Channels.Exists("ChannelName") Then
'Process data
End If

 You can use Channels.Exists("ChannelName") to test if a channel is in a channel group but Matthews answer is better if you want to know if a channel exists in the dataportal.

 

If CNo("ChannelName") > 0 Then 
'Process data
End If

 

0 Kudos
Message 3 of 3
(5,099 Views)