NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Determine if variable exists

Hi there.  I am trying to determine if a specific variable exists in my client file from my process model.I ran across this thread that describes how to use ProperityExists(), however that only seems to work in a scobe local to the file it is being called in and I have not found a way to access outside that.

 

I have an objext reference to my client file already and also have a reference to MainSecuence in the client file where the local variable is if that helps.. 

 

I want the process model to take a few extra steps when running client files where this variable is defined or do nothing if it isnt.

 

Thanks!

 

Greg

Gregory Osenbach, CLA
Fluke
0 Kudos
Message 1 of 8
(7,008 Views)

PropertyExists(RunState.ProcessModelClient.Data.Seq["MainSequence"].Locals.Foo)

 

The best way to do this is to have a callback where the client will set a flag if they want to use a certain option in the process model.  Similar to ReportOptions, ModelOptions and DatabaseOptions callbacks.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 8
(7,001 Views)

Thanks for the suggestion..  I had though I triend that one but perhaps I mis typed something or i didnt actually try it  🙂

 

Thanks!

Gregory Osenbach, CLA
Fluke
0 Kudos
Message 3 of 8
(6,998 Views)

hmmm..  So I have: Locals.Temp = PropertyExists(RunState.ProcessModelClient.Data.Seq["MainSequence"].Locals.here)   Wehere Locals.Temp is a boolean.  Always shows false weather the variable is there or not  😞

 

Gregory Osenbach, CLA
Fluke
0 Kudos
Message 4 of 8
(6,994 Views)

silly me..  that step was in skip mode..  hence the false reading 🙂

 

However,

with that line of code, I get this error:

 

The post-expression for the step 'Statement' could not be evaluated.
Error in argument 1, 'RunState.ProcessModelClient.Data.Seq["MainSequence"].Locals.here', in call to the expression function 'PropertyExists'.
Expected String, found Boolean.

 

😞

Gregory Osenbach, CLA
Fluke
0 Kudos
Message 5 of 8
(6,988 Views)

PropertyExists("RunState.ProcessModelClient.Data.Seq[\"MainSequence\"].Locals.Foo")

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 6 of 8
(6,977 Views)

BTW-

 

If you want to test out what will and won't be there during execution you can put a breakpoint in the process model somewhere and then just type expressions in the watch pane.

 

It's pretty slick so you don't have to sit there and run it a million times.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 7 of 8
(6,976 Views)

I had not realized you could use the watch pane with expressions in that manor..  I'll have to try that, thanks for the tip!

Gregory Osenbach, CLA
Fluke
0 Kudos
Message 8 of 8
(6,956 Views)