NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

dynamically change value of expression parameter

Solved!
Go to solution

 

For the below variable setup  i wish to create an expression to dynamically get the values of the subcontainers.

- I tried something like :    value 1 = Evaluate("FileGlobals.MainContainer." + locals.currentSubContainer + ".value1")

 

How do i use evaluate to dynamically change which container is read ?

 

locals.currentSubContainer = "subContainer1"

 

... get value 1 

... get value 2

 

locals.currentSubContainer = "subContainer2"

 

... get value 1

... get value 2

 

 

 

FileGlobals

    "MainContainer"

        "SubContainer1"

            "Value1"

            "Value2"

        "SubContainer2"

            "Value1"

            "Value2"

0 Kudos
Message 1 of 6
(3,648 Views)

Sounds like the property loader would be the best answer.....

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

I don't need to control it externally.

I just need to use same subsequence to do same thing multiple times using different settings.

The "setting" should be dynamically changed based on a parameter "A", "B", "C". ect.

Something like:

http://digital.ni.com/public.nsf/allkb/42099F16F8DDEA4286256CBB005D1C96

 

i just can't make it work.

0 Kudos
Message 3 of 6
(3,626 Views)

Locals.currentFrequencies.F1 = Evaluate("fileglobals.CalibrationSettings." + parameters.currentFrequencySet + ".F1")

 

 

Gives me an error:

 

"A range is only valid inside an array subscript"

 

what does it mean, and why ?

0 Kudos
Message 4 of 6
(3,621 Views)

Can you attach a small example of what you exactly tried?

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

Solved it.

 

TS apparently checks if the dynamic value "exists" in the Variable list.

The parameter  was "empty" in my list hence it didn't work. If I gives the subsequence parameter a "dummy" value that actually exists but overwrite this before real use, it works.

0 Kudos
Message 6 of 6
(3,619 Views)