DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL ADO script creates channels but all decimals have 0.00 as a value

Solved!
Go to solution

I have version 11.1 and the script works great, I get all the values. Another PC with version 11.0 runs the same script and all the channels that have a datatype of Decimal in SQL server have zero as value. I am setting the channel names like this, strChnls="Channel1,Channel2,Channel3,Channel4" and populating them with the code below. if channel 1 and 2 have integers or a datatime value, or character data it pulls those values in but it sets channel 3 and 4 (decimal datatypes) to 0.

 

Channels = Split(strChnls, ",")

For z = 0 To UBound(Channels)AsPos =

InStr(UCase(Channels(z)), " AS ")

IF AsPos > 1 THEN Channels(z) = Trim(Mid(Channels(z), AsPos+1))Channels(z) =

"[" & GroupDefaultGet & "]/" & Channels(z)

Next ' z

Channels = ArrayToChannels(RowVals, Channels, 1)

 

0 Kudos
Message 1 of 3
(3,794 Views)

More Info:

I found this in the 11.1 release notes.

The ArraytoChannels command does not support the VT_Decimal data type, which, for example, is provided by ORACLE data bases.

I assume this is the problem with the Decimal datatype for SQL Server as well. I dont want to iterate through the data and populate. Is there a way to get around this without changing the datatype on the database?

 

0 Kudos
Message 2 of 3
(3,780 Views)
Solution
Accepted by topic author Richard_C

The solution is to obvious. I don't know why I didn't just do this before I posted.

In the select statement or store proc. Whichever just 'YourRealField' = convert(real, YourDecimalField) and it works in both versions.

You may have to use round (convert(..... if appropriate.

0 Kudos
Message 3 of 3
(3,772 Views)