NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use PropertyExists when there is a string variable being reference?

I have a code that verifies if PropertyExists for PropertyExists("FileGlobals.Registers.DUT[\"PARTID\"].Address"). The problem I am facing is that "PARTID" is a parameter that is updated from the above subsequence which I call Parameters.regName_in.  Parameters.regName_in is of type string. If I use the viewer to verify the boolean on PropertyExists("FileGlobals.Registers.DUT[\"PARTID\"].Address") it is true, but I use the viewer to verify the boolean on PropertyExists("FileGlobals.Registers.DUT[Parameters.regName_in].Address") then it is false. From what I can tell it is missing the \" from the naming. This is something that is hard to add since Parameters.regName_in is dynamically loaded from an excel sheet. I should also note that the DUT variable is a container and I use the Parameters.regName_in to reference the location for a specific variable of type number (Address) under that location. 

 

Is there a way to reference the string variable in a PropertyExists execution? 

0 Kudos
Message 1 of 4
(1,657 Views)

PropertyExist(Evaluate(""))

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
Message 2 of 4
(1,616 Views)

Hey Bienieck,

 

This still does not work. I tried the expression: (Evaluate("FileGlobals.Registers.DUT[Parameters.regName_in].Address")) which does give out the correct number. Then I tried adding the Property Exists function which fails as a string is expected and not a number. So afterwards I tried adding /" to the " in the Evaluate portion as follows: PropertyExists("Evaluate(\"FileGlobals.Registers.DUT[Parameters.regName_in].Address\")") hoping it would fix the issue. Nevertheless, I still get False on what should be a True boolean. I also tried using the Evaluate on the Parameters.regName_in portion only to no avail as follows: PropertyExists("FileGlobals.Registers.DUT[Evaluate(\"Parameters.regName_in\")].Address")

 

Any other ideas or how to fix it? 

0 Kudos
Message 3 of 4
(1,601 Views)

Try PropertyExist(Str(Parameters.regName_in, "FileGlobals.Registers.DUT[\"%s\"].Address"))

 

My previous reply was incorrect. Sorry.

I don't have TS to test this but you will figure it out 😉

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 4 of 4
(1,590 Views)