NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom STEP_RESULT columns

Solved!
Go to solution

Hi all,

 

I'm totally stumped and I'm hoping someone here might be able to help me out.

I'm trying to log five custom values in each STEP_RESULT record. I have a model plugin that I've customized to add these values to each step result.

Parameters.ThisResult.NewSubProperty("NewContainer",PropValType_Container,False,"",PropOption_DoNothingIfExists),
Parameters.ThisResult->NewContainer.NewSubProperty("Temperature",PropValType_Number,False,"",PropOption_DoNothingIfExists),
Parameters.ThisResult->NewContainer.Temperature = <the temperature, gleaned from elsewhere>

I do the same with the other values.   Then I drop a breakpoint at the LogToDatabase callback in the database plugin. I can see in each MainSequence result that NewContainer is being populated and the values are there when the plugin logs to the database. So far so good.

 

I've set up a custom schema such that the new fields I want are added to the STEP_RESULT table.

STEP_RESULT = Logging.StepResult.NewContainer.Temperature

No matter what I do the columns show up as NULL in my SQL Server database.  I know for a fact that the values are populated at run-time, I know the schema references the correct variables. No run-time errors occur when the results are logged.

 

I tried removing the database plugin and adding it again to force the configuration to load.

I've double checked the schema. For each field/column I haven't set any precondition, and I've set the "Expected Properties" expression to the same as the variable referenced.

 

I tried using attributes attached to each step result, too, but observed the same outcome.

 

Nothing seems to get me where I need to be. Smiley Mad

 

What am I missing?

 

Thanks,

 

Mr. Jim

0 Kudos
Message 1 of 5
(2,478 Views)

Okay, I think I've substantially simplified the issue - I've gotten almost everything working. The last hurdle to overcome is the following:

 

(Sorry for the rambling nature of this post)

 

I have a field of "Date/Time" that is going into SQL server.  Even if I manually enter the following:

Date_Time.png

 

It shows up in SQL server as "2017-01-23 16:45:12.000"

 

Does anyone know how to get the fractional seconds working properly?

 

Thanks again,

 

Mr. Jim

0 Kudos
Message 2 of 5
(2,459 Views)
Solution
Accepted by topic author Mr._Jim

I have the following option on my SQL Server Stored

 

Screenshot_1.png

Message 3 of 5
(2,436 Views)
Solution
Accepted by topic author Mr._Jim

Which datatype does your column have in SQL? I think that by default TIMESTAMP type has no fractional seconds.

Please refer to this webpage for further info on this topic.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 4 of 5
(2,428 Views)

Hi Andres and Norbert,

 

Thank you very much for your replies - those were great hints.  I'd been staring at this too long and had been getting tunnel vision. I feel silly having missed that obvious possibility - I kept assuming that it was something I was doing wrong on my end!

 

Apparently the field in the table has been indeed set to a datatype that does not include fractional seconds.

The better news for me is that, upon finding this out, the party supplying me with requirements conceded that we don't need fractional seconds, so that requirement has now been eliminated.

 

Thank you again for your help and for enduring my esoteric and vague posts.  Smiley Wink

 

Mr. Jim

0 Kudos
Message 5 of 5
(2,422 Views)