NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get active/opened sequence path in plugin InitializationExpression

Hi, I am trying to get active sequence path through FileGlobals.ModelPluginComponentDescription.InitializationExpression which is a part of report processing plugin.

I was trying different thing without any success.

I tried eg:

1. RunState.Root.SelectedFile.Path
2. ThisContext.Main.SelectedFile.Path
3. RunState.InitialSelection.SelectedSequences.GetNumElements()
4. ThisContext.SelectedFile.Path

 

I have no idea how to get to this reference 😞 (I was able to get it, for instance, from plugin callback, but the expression did not work when TS instatiated plugin in Result Processing window).

 

The aim is to evaluate active sequence file path and use it as a default report path for newly instantiated report processing plugin.

Michał Bieńkowski
CLA, CTA

Someone devote his time to help solve your problem? Appreciate it and give kudos. Problem solved? Accept as a solution so that others can find it faster in the future.
Make a contribution to the development of TestStand - vote on TestStand Idea Exchange.
0 Kudos
Message 1 of 5
(3,666 Views)

Hello Michał,


More common and recommended approach is to ask user for specific report path. However, it is also possible to automatically update plugin options with recently opened sequence path.


To do it, try the following steps:
1. Open the chosen sequence file (for example Test.seq)
2. Create StationGlobal – for example TestStatGlob, type: Path
3. Go to Menu bar and select Edit>>Sequence File Callbacks
4. Find SequenceFileLoad and double-click on it. The “Present” state should change to “Yes”.
5. Click on Edit button – the SequenceFileLoad should be added to list of Sequences in your sequence file.
Choose callback
6. In sequence called SequenceFileLoad, add new step – Statement – and use the expression: StationGlobals.TestStatGlob=RunState.SequenceFile.Path
7. Save this sequence file and close it.
8. In your plugin sequence file, in Variables Pane go to FileGlobals>>ModelPluginComponentDescription>>Default>>Base>>OptionsDescriptionExpression and edit value of this variable. Set its value to StationGlobals.TestStatGlob
9. Save your plugin sequence file and close it.


Now, each time when you open a sequence file called Test.seq, it will be loaded to memory and the SequenceFileLoad Engine Callback will write absolute path to Test.seq file into the TestStatGlob variable. Then, if you insert new instance of your plugin in Result Processing window (Menu bar: Configure>>Result Processing…), you will see path stored in TestStatGlob variable in Options for your plugin. Remember, that if you have several instances of the same plugin added in Result Processing window, then all of them will be updated with the same value in Options when you open another sequence file with SequenceFileLoad Engine Callback inside it.


If you have any further question, please let me know.

Marcin Niewiarowski
LabVIEW Student Ambassador
National Instruments
0 Kudos
Message 2 of 5
(3,589 Views)

@bienieck wrote:

Hi, I am trying to get active sequence path [...]

The aim is to evaluate active sequence file path and use it as a default report path for newly instantiated report processing plugin.


Did you already try the report file macros?

You can use predefined macros to customize the UUT or Batch Report File Path expression. During an execution, the process model replaces the predefined macros in the UUT or Batch Report File Path expressions according to the options you select. [...]

$(ClientFileDir)—Replaces the macro with the directory that contains the client sequence file. For example, if you execute the client sequence saved as c:\Tests\TestSequences\TestSequence1.seq using an Execution entry point, $(ClientFileDir) specifies the c:\Tests\TestSequences directory.

 

This sounds promising, doesn't it?

 

Norbert

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

@Norbert I'm afraid that macros works only with default Result Processing plugin. At least this is how I interpret the TS help: "Note  The list of macros is for use only in the Specify Report File Path by Expression control on the Report File Pathname tab of the Report Options dialog box and not in any other TestStand expression controls."

Check the full topic here: http://zone.ni.com/reference/en-XX/help/370052K-01/tsref/infotopics/specifyreportfilepath_byexpressi...

 

@Marcin I'm not sure if this callback will work during plugin initialization but I will try this and I will let you know.

 

Thank you guys anyway 🙂

Michał Bieńkowski
CLA, CTA

Someone devote his time to help solve your problem? Appreciate it and give kudos. Problem solved? Accept as a solution so that others can find it faster in the future.
Make a contribution to the development of TestStand - vote on TestStand Idea Exchange.
0 Kudos
Message 4 of 5
(3,574 Views)

Michal,

 

you are correct that macros are developed for the NI Report Generator. However, the code is accessible (in most parts) so you can copy the relevant parts.

To be more precise: the macros are "addressed" in the NI_ReportGenerator.seq in the ModelPlugin - Initialize sequence. There is a step in there calling into modelsupport2.dll: SetReportOptionsFromPathMacros

My understanding is that this essentially takes care of the macros.

 

Norbert

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