NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a user guide section for 'Data Operation'?

I am in the evaluation phase and half way through my time.  I am validating my way through a series of tests for TestStand to handle and it is passing almost everything.  I am stuck on using Data Operations.  I find lots of advanced questions, and references to the what each part means, but I have not seen any examples for how to use it.

 

I simply need to query a (SQL)database table set and:

1)see how many rows were added over a time span and compare to expected.

2)pull the latest value from a column and compare to expected.

 

seems simple.  Is there a step by step guide to doing this?  I see a lot in the forums about people having problems doing similar things, but I don't see and guides for basic sql query validation.

 

Daniel

0 Kudos
Message 1 of 13
(4,323 Views)

Are you looking for something similar to this White Paper?

 

Creating a TestStand Database Schema from Scratch

 

 

Paul P.

Applications Engineering

Highest Regards,

Paul
0 Kudos
Message 2 of 13
(4,293 Views)

Hi,

 

You can try the database viewer (Tools -- > Database Viewer).

Once you connect using the connection string or UDL file then It lists all the tables.

You can right click and do view data.

For sorting just click on the various filters available in the column. (TS 2014 onwards).

In the SQL window you can write your custom SQL commands also.

 

You can refer its help menu for more details.

 

Hope this helps.

 

Ravi

0 Kudos
Message 3 of 13
(4,261 Views)

Yeah, that is one of my problems.  When I ask about database.. the question always goes back to logging.  Logging and the logging database schema I got working right away.  What I need is to query MY database and see validate a value?   I will be asking if the information from my hardware was sent correctly, or if it is being sent at all?

0 Kudos
Message 4 of 13
(4,254 Views)

Thanks.  I am looking to go beyond that, into something I assume is expected within TestStand.  Validate a database table entry(from one of my database tables).  It looks like it does it, just I haven't figured out how.  I know I need to Open Database, Open SQL Statement, use that SQL Statement and SOMEHOW use Data Operation to validate a part of that sql statement.  ... at least this is how I am interpreting what little I can find.

 

I could code this easy, but having it incorporated into TestStand's reporting and passing sql query values into variable or validating values from a database would be awesome!!

0 Kudos
Message 5 of 13
(4,249 Views)

Hi,

 

You can explore the database step types which can be used to read the data from DB.

You can start with the examples.(C:\Users\Public\Documents\National Instruments\TestStand 2014 (32-bit)\Examples\Built-In Step Types\Database Step Types).

 

Once you read the data you can use additional results step type to log the data in your reports.

 

Hope this helps.

 

Ravi

0 Kudos
Message 6 of 13
(4,247 Views)

Thanks, that did help a little.  Didn't solve it.  The examples are good, but there is not much explaination around them to understand why they did what they did and how to incorporate that into what I am doing.

 

1)I am missunderstanding what a Statement Handle is?  I was assuming this was a unique number(referring to it as a nickname - a handle) , variable, to call on a sql statement.  But, I keep getting 'Invalide SQL Statement Handle'

-the examples I find use 'Locals.StatementHandle' instead of a static number.  Does this matter?  what does this declare?

-if I create an OPEN and give it a handle.  this handle should also match data operation?  in the examples, these are never static so I could be reading into this wrong.

2) I need a method to bring back a single table value, based on a query.  Seems so simple.  What is the last reading from our instrument?.. and add this to a variable to be used by other parts of TestStand.

3) I need a method to bring back something about the table.  How many rows were created in the last hour?.. and add this to a variable to be used by other parts of TestStand.

 

I am still reviewing that example and may be able to crack the code a little more today.

 

DD

0 Kudos
Message 7 of 13
(4,200 Views)

I believe that Locals.StatementHandle is a variable specified in the examples as a place for the steps to store SQL handles, as opposed to just creating and disposing of them as soon as the step is done.  This might be so that a handle could be used in code somewhere if needed.  

 

Perhaps the help documentation words it better?  

 

As for the other questions, are you looking for a TestStand example of these methods in particular, or are you wondering more about how to implement this with SQL statements?

 

Paul P.

Applications Engineering

 

 

Highest Regards,

Paul
0 Kudos
Message 8 of 13
(4,165 Views)

Yes, I have tried and never actually got them to work.  Bring back ANYTHING from the database and let me use that.. a single value, or count the number of rows.. then let me use that as a variable.

 

 

0 Kudos
Message 9 of 13
(4,160 Views)

Hey Daniel did you ever resolve this?  It sounds like a similar issue to the one I’m experiencing where my data operation returns no results but I know it should.

0 Kudos
Message 10 of 13
(3,215 Views)