NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

decimal places in database numeric column

Solved!
Go to solution

Hello everybody,

 

I have a very simple question, but yet I have not found a way to do this. I want to limit my measurement (via LabVIEW code module) to 2 decimal places in the report output and in the database (Generic Recordset) PROP_RESULT's numeric column.

 

I noticed that by changing the Result Processing's Report Option numeric output format, I am able to get the report output to 2 decimal places. But to get the measurement value stored in PROP_RESULT table's Numeric row is quite a challenge.  I have not been able to figure it out how to proceed.

 

In the LabVIEW code module, I set the measurement so that it returns a value with 2 decimal places to the Teststand parameter (Step.Result.Numeric, using Limit test). Strangely, it still show up in the PROP_RESULT's numeric row with 13 decimal places, which is quite a puzzle to me. How can Teststand came up with the measurement with 13 decimal places when the code module returns the measurement with 2 decimal places???  Does anyone has experience this before? Any information on how to solve this problem?

 

Thanks for reading.

 

yours,

hlim

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

If you went into the Generic Recordset (NI) / STEP_NUMERICLIMIT1 / DATA location, you can see that the result column in that table is a double precision. It will convert whatever number you have into a double precision and send to the database.  As such, it will appear to have 13+ decimal places (always consider scientific format when working with doubles and understanding precision). Just above it is DISPLAY_FORMAT which should  tell you that %0.2f is the display format that you want. At this stage, it is stored properly into the database. When you recall the data from the database, you should also check DISPLAY_FORMAT to check.

 

Another option is to change the default behavior of the record portion. Instead of recording the data as Numeric, you need to convert it to string and then store that way.  in the DATA step, you need to change the type to String (BSTR) and set the size to 255. Also the Value to Log now becomes "Str(Logging.StepResult.Numeric,Logging.StepResult.Numeric.NumericFormat)"

 

 

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

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

Hello bsvare,

thanks for the information. I now understand a little better why the numeric value is written with 13 decimal places into the database. I noticed that the DISPLAY FORMAT fields cannot be changed (to change it to %0.2f). I suppose I need to change it in another configuration location.

 

Yours

hlim

0 Kudos
Message 3 of 5
(4,335 Views)
Solution
Accepted by topic author hlim

There's a chance that you can't change it because it's a NI schema. They start out as locked files and you can't edit them. You can manually unlock by checking "Allow Editing of Schema". Preferibly, you should copy the schema and make your changes on the new one.

 

However, the information that is passed to the field IS the information defined when you create your numeric limit test. Under the limits tab, the bottom item is Numeric Format which you can customize and will be recorded to database.

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

Message 4 of 5
(4,324 Views)

Hallo bsvare,

thanks for the information. I shall evaluate the options you provided and see how far I can get on this. I am reluctant to change the NI Schema but I may have.

 

Cheers,

Huck

0 Kudos
Message 5 of 5
(4,310 Views)