DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Add ElementList entry from DataFileLoad

If I run the following two commands:

 

Dim oMyList : Set oMyList = Data.CreateElementList
Call oMyList.Add(DataFileLoad("C:\Program Files (x86)\National Instruments\DIAdem 2012\Examples\Data\Example_data.TDM", "TDM", "Load"))

 with the Run Script button I get that error message:

 

"The DataElement argument of the Add method must be Element<Data>."

 

Running it as Debug/Continue Script, it works perfectly.

 

Why?

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

The helps says, that Add only acceps a single elment.

 

Dim oMyList : Set oMyList = Data.CreateElementList

dim elems : set elems = DataFileLoad("C:\Program Files (x86)\National Instruments\DIAdem 2012\Examples\Data\Example_data.TDM", "TDM", "Load")
dim elem : for each elem in elems
  Call oMyList.Add(elem)
next

 should work. On my machine DIAdem 2012 your code fails in each mode.

0 Kudos
Message 2 of 3
(4,716 Views)

Strange that the code fails on your machine but not on mine.

 

Nevertheless I meanwhile applied the same solution you suggested, athough in my specific case it is only a single ChannelGroup that is being loaded into the DataPortal each time. As the ReturnValue of DataFileLoad then contains only one element of type ChannelGroup, I supposed that the Add method works directly, but it doesn't.

0 Kudos
Message 3 of 3
(4,711 Views)