NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to ask user for specific variables based on which modules are in sequence?

Let's say I have three tests set up in individual LabVIEW modules - Test 1 has variable x, Test 2 has variable y, Test 3 has variable z. In TestStand, I want to ask the user for values of the variables at the beginning that are only needed based on what tests are in the sequence (Example: Sequence has Tests 1 and 2. I want the pop-up messages to only ask for variables x and y). It's a time-based sequence, so I need to collect variables at the very beginning and not in between calling the modules. I think I should use ThisContext to access the variables, but I don't know how to only limit it to the variables that are present in the current running sequence.

Alternatively, I was thinking to have an if statement that goes through all the possible Tests and asks for variables, but that will be limiting if later we add more tests, change the names of tests, etc.

 

Any idea?

0 Kudos
Message 1 of 4
(205 Views)

Hello Wootie, and welcome to NI Forums, in order to get the best help from the community it always a good idea to attach the VI's and/or photos of your VI in your post. Do this by using the "Drag and drop here or browse files attach" option in your reply. 

0 Kudos
Message 2 of 4
(178 Views)

Unfortunately, I work in a secure facility.  

Does my question make sense though?

0 Kudos
Message 3 of 4
(107 Views)

Try something like this:

1.) Create a Shared Container for Inputs 

  • In the sequence file, go to -> Variables -> FileGlobals
  • Create a container call it something like 'TestInputs'
    • FileGlobals.TestInputs
      • x (Number)
      • y (Number)
      • z (Number)

2.) Tag each test step with what it needs

  • For each step that calls a LabVIEW module:
    • add a custom property named something like 'RequiredInputs' it might be a string array
      • Test 1 step -> ["x"]
      • Test 2 step -> ["y"]
      • Test 3 step -> ["z"] this will tell TestStand which variables each step needs

3.) Add a "Collect Inputs" step at the beginning 

  • In the Setup group, insert a new step called Collect Inputs.
  • This step will:
    • Look at all steps in the sequence (Main group).
    • Check which ones are enabled and not skipped.
    • Gather all RequiredInputs from those steps.
    • Prompt the user for those values (only the ones needed).
    • Store them in FileGlobals.TestInputs

4.) Bind each test's parameters to FileGlobals

  • For Test 1’s LabVIEW module:
    • Map its input parameter to FileGlobals.TestInputs.x
  • For Test 2:
    • Map to FileGlobals.TestInputs.y
  • For Test 3:
    • Map to FileGlobals.TestInputs.z

5.) Try it

  • The "Collect Inputs" should only ask for x and y if the sequence includes Test 1 and Test 2
  • If you add a 4th Test needing 'a', just tag it with ["a"] and add 'a' to the container

 

Accessing Dynamic Properties - NI

Accessing Dynamic Properties in LabVIEW - NI

TestStand Custom Step Type Development Best Practices - NI

0 Kudos
Message 4 of 4
(103 Views)