From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How cam diadem check if channel exist before loading channel with DataFileLoadSel

Dear,

 

My problem is simple. I my code I use DataFileLoadSel(..,...,..., "register") to load selectively channels from tdms file. However, from one file to another the channel I want to load amy exist or not. How can I check this. In fact, if the channel does not exist then it generates an error message and my program ends.

 

Thank you for your help,

 

Best regards,

 

Louval

 

0 Kudos
Message 1 of 4
(5,078 Views)

Hi Louval,

 

If you want to load the channel if it exists each time, then I'd just put error handling around that call.  There are other options, but they're more complicated.

 

On Error Resume Next
Call DataFileLoadSel(DataFilePath, ...)
ErrNum = Err.Number
On Error Goto 0

IF ErrNum = 0 THEN ' Success
  
ELSE ' failure

END IF ' selected channel loaded

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

 

0 Kudos
Message 2 of 4
(5,055 Views)

Hi Brad,

 

All I needed, as usual. This is great thank you so much.

 

Cheers,

 

Louval

0 Kudos
Message 3 of 4
(5,027 Views)

Hi Louval,

 

you can also check the Dataportal for existing channels, if you know the groupname or index of the group:

 

data.Root.ChannelGroups(Gruppenindex als Zahl).Channels.Exists("Name")

 

Kind Regards,

 

Philipp

AE | NI Germany

0 Kudos
Message 4 of 4
(4,975 Views)