NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Are the RunState.step and ThisConText.RunState.step the same?

Hi:

 

     I don't understand the difference between the "RunState.Step" and the "ThisContext.RunState.step".Can someone explain for me?

Any help appreciated!

0 Kudos
Message 1 of 9
(5,452 Views)

Yes they are the same. "ThisContext" is just a self-referential pointer back to the context (which is the root-level object in this case). You can even do "ThisContext.ThisContext.ThisContext." for however long you want. The purpose of "ThisContext" is for when you need to pass the context itself as a parameter to a code module or something similar.

 

Hope this helps,

-Doug

Message 2 of 9
(5,441 Views)

Hi:

 

    Doug,thank you for your repaly! Just i want to know that which conditions we can use "RunState.Step" and which conditions we can use "ThisContext.RunState.Step".Maybe the conditions in which they are used are the same fully? Any help appreciated!

0 Kudos
Message 3 of 9
(5,433 Views)

The only reason to ever use ThisContext is if you want to pass the current context itself somewhere. It's like a "this" pointer in C++. It's harmless and ok to do "ThisContext.RunState.Step" it's just unnecessary and the same as just doing "Step" or "RunState.Step". The expressions Step, RunState.Step, and ThisContext.RunState.Step all refer to the same thing.

 

-Doug

Message 4 of 9
(5,418 Views)

Hi:

 

    Thank Doug's reply.I also have a question that whether  RunState inherits from ThisContext.RunState. And what is the relationship between "RunState"and

"ThisContext.RunState"? Waiting response imperatively!

0 Kudos
Message 5 of 9
(5,408 Views)

They are the same property. Some properties in TestStand are aliases/pointers to properties that already exist elsewhere. This is such a case.

 

-Doug

Message 6 of 9
(5,398 Views)

Hi:

 

   What about the "RunState" and the "ThisContext.RunState"?

0 Kudos
Message 7 of 9
(5,389 Views)

Hm..... repeating the same question over and over again is not giving you different answers.

As Doug already stated:

ThisContext is a recursive "this" pointer to the whole data set of your execution.

 

You should get familiar with the concept of this pointers if you don't understand the answer Doug already provided some postings ago....

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 8 of 9
(5,374 Views)

@xiaochan wrote:

Hi:

 

   What about the "RunState" and the "ThisContext.RunState"?


In case it wasn't clear, my last answer was in regards to these two properties.

 

-Doug

0 Kudos
Message 9 of 9
(5,368 Views)