NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting NaN into a Database

I am using TestStand 3.5, and the IVI step types to query DMM's and Oscopes. I am then logging that data to a SQL Server 2005 database. The problem comes when I have values that are above the range of the equipment, and they return a NaN.  TestStand then tries to write this to the database, but the database does not accept or understand a NaN, the equivalent in SQL being a NULL.  Has anybody been able to address this NaN -> NULL issue, or any ideas on how to deal with it.
 
Along the same lines LabVIEW has the concept of +Inf and -Inf, I ask the same question does anybody know how to deal with this in a SQL database.
 
0 Kudos
Message 1 of 2
(5,145 Views)
Hi,

I had the same problem with a MySQL database.
You can read my post : the subject is NaN and MySQL.

The TestStand users gave me many suggestions.

Here is the way I use :

- First of all, I suggested to the sequence developpers to avoid the use of NAN, +/-INF and IND values, because of the comparison issue and the database issue.
They can intercept the result with a data source expression like : (Step.Result.Numeric == NAN) ? arbitrary value : Step.Result.Numeric.

- But an unexpected NAN value (or another invalid value) could be returned and the database should accept this value.
So I inserted a new column in my database (table meas_numericlimit), that indicates an invalid value.
Then you should modify the TestStand database schema
(statement STEP_NUMERICLIMIT) :
            1/ to log the numeric value only if it is not an invalid value
            2/ to indicate the invalid value in the new column (add the new column to the database schema)

Bruno
0 Kudos
Message 2 of 2
(5,135 Views)