04-11-2012 02:50 PM
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??
04-12-2012 05:14 AM
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
04-12-2012 08:44 AM - edited 04-12-2012 08:53 AM
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