NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Activate Additional Results for all Steps in SEQ which call one DLL

Solved!
Go to solution

Hello together,

i would like automatically activate two"Additional Results" hooks, for all Steps in an SEQ which use the DLL UdsSoma.dll

 

Is this possible in TestStand? 

 

Icing on the cake would be, if i also could insert a "Condition" Expression into the two "Additional Results" - but that is not that critical.

 

Thanks a lot in advance for your help!

 

Jo__Ho_0-1721895849735.png

 

Jo__Ho_1-1721895892023.png

 

 

0 Kudos
Message 1 of 9
(554 Views)

You can use the TestStand API to do so.... have a sequence analyze your target sequence for special steps and modify them accordingly.

Makes sense if this is something which is used regularly and can eventually be integrated to the Tools menu.

 

 

Message 2 of 9
(534 Views)

Hello Oli_Wachno,

thanks for your reply!

 

Could you help create the TestStand expression for me, which does this?

 

I would like to "update" all the SEQ files on one machine - in total this would be around 12 SEQs with around 150 Steps in each SEQ -  so an automation would save me a lot of headache 😄

0 Kudos
Message 3 of 9
(495 Views)

Due to capacity not the complete thing, yet I may throw some parts of the solution at you 😉

0 Kudos
Message 4 of 9
(483 Views)

Scanning TestSteps from sequences can be found in the TestStand Examples.

 

For every Step you

 

//check if step uses .net adapter
Step.AdapterKeyName == DotNetAdapter

//if .net step check if desired assembly is used by either comparing to

Step.TS.SData.AssemblyStrongName (I'd recommend this)
or
Step.TS.SData.AssemblyPath

// if it is the right assembly, add additional result using something like

Step.AdditionalResults.CustomResults.Insert("Locals.ValueName", "Locals.Value", "TRUE", PropFlags_IncludeInReport, -1)

//when done increment change count
SequenceFile.ChangeCount()
// and save
SequenceFile.Save()


Disclaimer..... not completely validated, but should give you a good guidance

Message 5 of 9
(475 Views)

Thank you for your commands!

 

I used the example "Creating a Sequence File iteration"  this is a big step in the right direction.

Thank you!

 

I used the two if-checks you suggested:

Parameters.Data.AsStep.AdapterKeyName == "DotNet Adapter"

and 

Parameters.Data.AsStep.Module.AsDotNetModule.ClassName == "UdsSoma.UdsSoma"

 

But now i face the problem, that i need to set this Variable in order to change the "hook" described in the screenshot above.

RunState.Step.TS.SData.Calls[1].Params[2].AdditionalResults.Input.CheckedState  to the value "2" 

 

But the example SEQ passes the STEP as "Parameters.Data.AsStep" -- but passed as Reference in this way i could not find/access the variable ...SData.Calls[1].Params[2].AdditionalResults.Input.CheckedState and so on.

 

Do you have an idea how the set the value of this variable?

0 Kudos
Message 6 of 9
(448 Views)

@Jo__Ho wrote:

Thank you for your commands!

 

[...]

RunState.Step.TS.SData.Calls[1].Params[2].AdditionalResults.Input.CheckedState  to the value "2" 

 

But the example SEQ passes the STEP as "Parameters.Data.AsStep" -- but passed as Reference in this way i could not find/access the variable ...SData.Calls[1].Params[2].AdditionalResults.Input.CheckedState and so on.

 

Do you have an idea how the set the value of this variable?


Couldn't access in "expression gives an error in SequenceEditor" or "throws a runtime error when executing"?

Message 7 of 9
(441 Views)
Solution
Accepted by topic author Jo__Ho

Thanks Oli_Wachno,

i got it working:

 

so here a short tutorial, if someone else wants to do something similar:

- download the SEQ from this example: "Creating a Sequence File iteration"  

- Edit the SubSequence "RunForEachStep" 

-> i skipped everthing 

-> then i added an if-condition: Parameters.Data.AsStep.AdapterKeyName == "DotNet Adapter"

-> inside i added another if-condition: (Parameters.Data.AsStep.Module.AsDotNetModule.ClassName == "UdsSoma.UdsSoma") && ( Parameters.Data.AsStep.Module.AsDotNetModule.MemberName == "UdsCmd")

-> inside this if-condition i added the following statement:

Parameters.Data.AsStep.Module.Step.TS.SData.Calls[1].Params[1].AdditionalResults.Input.CheckedState = 2,
Parameters.Data.AsStep.Module.Step.TS.SData.Calls[1].Params[2].AdditionalResults.Output.CheckedState = 2,
Parameters.Data.AsStep.Module.Step.TS.SData.Calls[1].Params[1].AdditionalResults.Input.Condition = "FileGlobals.FTSModeActive==True",
Parameters.Data.AsStep.Module.Step.TS.SData.Calls[1].Params[2].AdditionalResults.Output.Condition = "FileGlobals.FTSModeActive==True"

 

If you let this run on your SEQ-Folder all the steps meeting the "conditions" will be edited.

 

Somehow on my laptop the changes were only saved, when i had the SEQ File opened in TestStand while running this and then manually clicked on "save" on the automatically-edited SEQ file.

 

 

0 Kudos
Message 8 of 9
(432 Views)

Jo__Ho_0-1722598309773.png

 

Jo__Ho_1-1722598315645.png

 

Here the marked in color which lines in the expression match the result (above)

0 Kudos
Message 9 of 9
(429 Views)