NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Database logging to my own table

We have been collecting data for a long time in two tables (using ACCESS)as we used our old systems using VB. Now, that we switched to TS, I'm interested to log data into these tables which are naturally much different thatn the TS default tables.

How do I go about it?

Shall I start by creating a new 'LogToDatabase' call back where I build my own routines of writing into my own tables?

Or, is there an easier way by using a new schema (I read about it but feel far from comprhending it)?

Or, may be I should try to modify an existing schema to match my tables (if it possible..) ?

Thank you very much
Rafi
0 Kudos
Message 1 of 5
(3,468 Views)
Hello Rafi,

TestStand allows for three different ways to log to a database:

1) Automatic database logging feature that can be enabled.

2) Data base step types that are wrappers for SQL commands.

3) Property loader step that can import/export properties directly from a database.

The first method is useful when you want to log information about all of your steps. If you only want to log specific data, I would not recommend it. The property loader step is really intended to be used either at the beginning or ending of a sequence to set or save default values. It is not the prefered method for data logging. Using our database step types are the best way to accomplish what it sounds like you want to do.

To get started, I would take a look at the two
example sequence files that can be found in the folder:

:\Program Files\National Instruments\TestStand\Examples\Database

I hope that you find this information helpful. Thank you for contacting National Instruments. Take care!

Aaron B.
National Instruments
0 Kudos
Message 2 of 5
(3,468 Views)
Helo AAron,

First, thank you very much for your answer.

I will take a look at the examples you pointed out, but in the meantime...if I use the DB step types it means that for every step of my sequence (CVI step) I must add another line (sub SEQ)for the database handling. Am I correct?

Now, TS is doing everything by itself as if it's not even part of your sequence. Since we want to write always the same fields in different test, I would like to find a solution that it will be done automatically.

I tried to creat a new schema and then modify it for my tables. Is this approach any good? It requires that I specify manually each field of the table, define it so it matches the table definition and than specify where to take the data from. Am I correct
?

Can you elaborate a little more on the property loader. I think I'm missing the point here.

Thank you
0 Kudos
Message 3 of 5
(3,468 Views)
Rafi -
Out of all your options to log data to a database, the TestStand database step types would be the slowest because they are intended as a high level "non-programming" way of accessing databases. Using a programming language and potentially a toolkit to assist you would have better performance.

If you can get the database logging feature of TestStand to match or mirror your database needs, then this clearly would require no programming, but just configuration.

If you have not already read the Database Logging, Chapter 6, in the TestStand Reference Manual, please do so, because it describes at a high level how the feature processes the schema configuration and applies its settings as it traverses the result list from the executio
n.

It is always helpful to look at an existing schema and see how it mirrors the corresponding database.

What do your database tables look like? Do you have both UUT results and step result tables. Do you have Measurement tables, that is tables that have multiple results per step? What field/column data is stored in each of your tables.

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 4 of 5
(3,468 Views)
Hello Rafi,

I will try to answer each one of your questions separately:

1) You could do this. I think you will find that when programming in TestStand, there is no one right way, but many ways to accomplish your goal. For instance, if you were to use a custom step type, you can add database logging in a substep module (custom step types allow you to add code modules both before an after the main module has been executed). If you put database logging to a subset, everytime you execute that step type you will automatically call the database logging substep.

2) Yes, this is the correct strategy; however, many customers prefer to start with a generic schema that we provide and modify it.

3) The property loader is used load values from a text
file or database into TestStand variables. You can also use it to export TestStand variables to a text file or database. It is typically used in either initialization steps to initialize TestStand variables and or step limits, or in cleanup steps to save the current configurations (exporting is also used to create a template of a file to be later used for loading...the utility in this technique it to ensure that syntax is correct).

I hope that I have answered your questions suficiently. Thank you for contacting National Instruments and have a great day!

Aaron B.
National Instruments
0 Kudos
Message 5 of 5
(3,468 Views)