NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically disabling Database Recording

OK, I've asked about this a couple times, maybe someone can explain why all this work is not giving me the desired result...

 

I have two databases configured.  I need to toggle one or the other off depending on the input at the Pre-UUT Serial number input.

 

I have a routine that runs through the pugins looking for the database sequence.  Then I look in that sequence for the name of the schema (which is the name of the schema inside the DB setup window, not necessarily the name of the DB in the database)

 

When I find the one I want to disable:

  RunState.Root.Locals.ModelPluginConfiguration.Plugins[<N>].PluginSpecific.Options.DisableDatabaseLogging = True

 

I have checked the variables when the db seq executes, and it's definitely set correctly.  However, the DB inserts every time.

 

Any ideas?

 

0 Kudos
Message 1 of 3
(1,058 Views)

Hi Jed,

 

I think the reason you're not seeing the change reflected has to do with order of operations. TestStand has a set of pre-defined callbacks that expose different bits of functionality and which execute at the correct time in the sequence of TestStand execution to ensure that those things are configured programmatically at the right time. You want to make this modification inside the "DatabaseOptions" callback for it behave the way you expect. From the callback sequence, you'll find a "Database Options" container inside the Parameters for the callback sequence. Inside DatabaseOptions, you'll find the property "DisableDatabaseLogging" which is what you'll want to set to programmatically enable/disable database reporting.

 

EDIT: I definitely overlooked some context as I was typing up my response - the part where you have multiple database plugins you're working with. In that same callback, you'll also find a "ModelPluginConfiguration" container which has the same structure as the one you're setting through Runstate.Root which you should be able to use to toggle each database logger separately.

Regards,
0 Kudos
Message 2 of 3
(987 Views)

Hi Jed,

 

Could acheive logging selectively to DB ( chosing between two DB based on some flag) by the following method :

Added two DB in the results configuration as shown below :

RaviShrigiri_0-1644086623456.png

 

Override "log to database" proces model callback into the test sequence :

RaviShrigiri_1-1644086798352.png

 

The "log to database" will be called twice for the two plugins.This will be called after testing is completed.

 

You can put a customized if condition to execute the callback in the log to database sequence.The data will be logged selectively based on the if condition.

RaviShrigiri_2-1644087054718.png

 

In the above example the if condition is

"(Find(Parameters.ModelPlugin.PluginSpecific.Options.ConnectionString,"TestStand Results.mdb") > 0)"

i.e. if access database file name is "TestStand Results.mdb" then log else dont.

 

You can add your custom if condtion based on database selected and events in the pre uut.

 

Hope this helps.

 

Ravi

 

0 Kudos
Message 3 of 3
(965 Views)