NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

PropertyExists Bug?

Solved!
Go to solution

 

I'm trying to determine if a variable exists, just like I've done many many times in the past and I'm finding this unexpected behavior...

 

Does anyone have a clue of what could be going on in here?Basically the PropertyExists method evaluates to False but when I add the property to the Watch View it actually returns a valid value

 

Is this a known issue? (Using TS2010SP1 on W764bit)

 

Bug.png

 

Thanks,

 

<<-N->>

0 Kudos
Message 1 of 10
(4,449 Views)

Solved this problem by using Parameters.Caller.Exists("Step.TekStep.Common.Retry.Grouped",0) to look for the property in the caller context

0 Kudos
Message 2 of 10
(4,444 Views)
Solution
Accepted by topic author icastillejos

Hi,

 

Syntax

PropertyObject.Exists ( lookupString, options)

Return Value

Boolean

Returns True if the property exists.

Purpose

Returns True if the property the lookupString parameter specifies exists.

Parameters

lookupString As String

[In] Pass the name of a subproperty within the PropertyObject. Refer to Lookup Strings for more information about the strings you can use.

options As Long

[In] Pass 0 to specify the default behavior, or pass one or more PropertyOptions constants. Use the bitwise-OR operator to specify multiple options.

 

Regards
Ray Farmer
Message 3 of 10
(4,439 Views)

Is your Caller parameter a reference? If so this is a known limitation that will be addressed in a future version. The internal issue tracking number is 200893 if you ever need to discuss it with NI.  Your work around is the recommended work around.

Message 4 of 10
(4,428 Views)

It is a reference indeed, thanks for the CAR info...

0 Kudos
Message 5 of 10
(4,418 Views)

Still having the same issue in TS 2014.  Has this been addressed?

CLA, CTA
Not my tempo... AGAIN!
0 Kudos
Message 6 of 10
(3,950 Views)

It was fixed in TestStand 2012. One thing that might be leading to some confusion though is that you need to leave out the name of the property that the object reference points to. For example:

 

If you have an object reference variable "Locals.Var1" and that is set to a variable called Var2 which contains a subproperty called Var3 you have to use the lookupstring "Locals.Var1.Var3" to access Var3 rather than "Locals.Var1.Var2.Var3".

 

Hope this helps,

-Doug

0 Kudos
Message 7 of 10
(3,928 Views)

Hi Dug, thanks for the response.  I think I understand what you're saying, but maybe I don't.  Can you explain to me how I should modify my PropertyExists statement in this specific instance so it correctly recognizes the existence of RunState.Root.Sequence.Locals.UUT.SerialNumber, in accordance with your previous post?

 

Thanks for your time!

CLA, CTA
Not my tempo... AGAIN!
0 Kudos
Message 8 of 10
(3,888 Views)

RunState.Root.Sequence.Locals.UUT.SerialNumber is not actually a PropertyObject property path, you should be using RunState.Root.Locals.UUT.SerialNumber instead (without "Sequence"). Your access to "Sequence" is really an API in expressions access to the API property, Sequence, on the SequenceContext interface. It's not a PropertyObject subproperty. You can see this if you look in the variables view under the RunState.Root property while at a breakpoint. There is no "Sequence" subproperty there.

 

Hope this helps clarify things. Let me know if you have any additional questions regarding this.

-Doug

Message 9 of 10
(3,862 Views)

OK.  That makes sense.  Thank you for taking the time to answer that, Dug!

CLA, CTA
Not my tempo... AGAIN!
0 Kudos
Message 10 of 10
(3,847 Views)