NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Sequence object from pre-step substep of Sequence Call based step type

How to obtain reference to Sequence object from within pre-step substep of Sequence Call based custom step type?

Given: new custom step type which based on NI Sequence Call step type. There is Pre-Step substep exist for this step type.

How to get reference to Sequence object representing Sequence which will run?

Although there is possible to examine SequenceAdapter and SequenceCallModule properties, it seems redundant since module (Sequence) is already loaded by TestStand ("NI TestStand Reference Manual. Table 3-4. Order of Actions that a Step Performs"   Action #6, while my code is running as Action #13).

 

Thanks.

Misha

0 Kudos
Message 1 of 7
(3,722 Views)

Could you explain what you want to do ?

Why do you want to get the sequence object within a pre-step substep ?

 

I give you some informations but I don't know if it's the better way to do what you want (because I don't know what you want to do with the sequence object).

 

If the substep uses the ActiveX adapter :

You can get the sequence object but you should save the object reference in a StationGlobals variable.

And you should release the object reference within your sequence when you don't need it any more.

 

If the substep uses another module adapter: 

Get the step module, then the sequence name (module property).

Then get the sequence object by the sequence name from the sequence file.

 

Here are the paths to use for both methods :

Sequence Name property path : Step.Module.SeqName

Sequence Object path : RunState.SequenceFile.GetSequenceByName (seqname)

0 Kudos
Message 2 of 7
(3,719 Views)

Bruno,

 

The substep uses the C/C++ DLL adapter, but it doesn't matter.
As I stated, there is no problem to get "SequenceFilePath", "SequenceName", "SpecifyByExpression" and "UseCurrentFile" of corresponding "SequenceCallModule" object, process them, and then call "SequenceFile.GetSequenceByName()". But this is what TestStand do, when it loads the module, therefore TestStand should keep the reference to Sequence object ready-to-use. And I want to get this reference without additional effort.

 

Thanks.
Misha

0 Kudos
Message 3 of 7
(3,716 Views)

Hi,

 

RunState.SequenceFile is the object of the currently loaded sequence file, therefore, if you wanted to launch a sequence from MainSequence while it is running then you can call TS API Engine.NewExecution(RunState.SequenceFile, "MySequenceToRun", Nothing, False,0,,). But normally you would just use a SequenceCall Adapter set to run in New execution.

 

Hope this helps

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 4 of 7
(3,710 Views)

Ray,

 

I don't want to launch no executions. I need to get reference to Sequence object.

 

Thanks.

Misha

0 Kudos
Message 5 of 7
(3,705 Views)

mishaw,

 

I don't know of a way to directly get the reference to the sequence module that TestStand has already loaded.  The only way that I found was to use what you had done: use the options of the SequenceCallModule to load the SequenceFile and then get the Sequence.

 

What are you trying to accomplish?  If we could discuss what you are trying to do, mabye there is a better way to implement it.

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 6 of 7
(3,698 Views)

Josh,

 

My task is to create step type similar to NI SequenceCall which should run only once during test session (unless "Unload All Modules" command executed or TestStand shutdown).

I added Pre-Step and Post-Step substeps(code is attached) to the copy of NI SequenceCall.

I would highly appreciate, if you show me the better way to implement it or improve my code.

 

Thanks.

Misha

0 Kudos
Message 7 of 7
(3,694 Views)