07-28-2016 03:16 PM
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.
08-02-2016 09:42 AM
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.
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.
08-02-2016 10:04 AM
@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
08-02-2016
03:07 PM
- last edited on
10-21-2024
09:53 AM
by
Content Cleaner
@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: https://www.ni.com/docs/en-US/bundle/teststand/page/specify-report-file-path-by-expression.html
@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 🙂
08-03-2016 02:52 AM
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