DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Record dialog table values into a new channel

I am trying to make a dialog window where a user can enter engine speeds and those values will be transferred to a newly created numeric channel.  This is working to get the table values to an array, but if I try to assign the values to oSpeedChannel I get an error that these values can not be assigned due to the DataType Float 64 of the channel I created.

 

Sub bOK_EventClick(ByRef This) 'Created Event Handler
 
'Sub SaveSpeedData
dim oPara
    
Dim oMyRoot, oMyGroup, oSpeedChannel, i
Set oMyRoot = Data.Root
Set oMyGroup = oMyRoot.ChannelGroups.Add("Lug_Spec")                      'Create new group
Set oSpeedChannel = oMyGroup.Channels.Add("Speed", DataTypeFloat64)  'Create new channel
 
 
  For i = 1 to 5
  
  oSpeedChannel.Values(i) = Table1.Cells(i,1).Value
  
  Next 
 
msgbox oSpeedChannel.Values(2)
'End Sub
 
End Sub
 
Here is what my table looks like
simple_diadem_Table.jpg
 
When I click ok It creates the channel, but errors out at the line for oSpeedChannel.Values(i) = Table1.Cells(i,1).Value
 
simple_diadem_Table_Error.jpg
Is there a different way to read in table values from a dialog window that I can import into a numeric channel?

 

0 Kudos
Message 1 of 2
(614 Views)

Hi OKCat2015,

 

You can use the Val() function of DIAdem to convert the text values into double values.

It would work like this:

oSpeedChannel.Values(i) = Val(Table1.Cells(i,1).Value)

 

 

0 Kudos
Message 2 of 2
(557 Views)