LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

create local variable using labview scripting

I am trying to use labview scripting to create a control and a local variable for that control.  I want both the local variable and the control contained inside a case structure.  My problems are twofold:

1. the local variable is left blank/unnamed

2. the local variable is wired outside of the case structure, even though I set it's owner to be the same as the owner for the control (which is placed inside the case structure).

 

The flat panel is there because I thought that my problem might be a result of the local var being created before the actual control, so this just forces the control to be created first.  The other thing I wonder about is the VI Object Class for the local variable.  I have tried 'Node' and Control->Boolean, but neither worked.

 

I have attached a jpg of the code I'm talking about.  The picture on thetop is of the code in question.  The picture on the bottom is of the resulting code that's created....

 

Can anyone offer any help?

 

Thank you...

0 Kudos
Message 1 of 5
(3,512 Views)

The reason your locals aren't tied to a control, is because you didn't make a local variable from any control.  Use the Boolean reference wire and wire it to an Invoke Node and select the Create >> Local Variable method.

Message 2 of 5
(3,499 Views)

After you create the local variable, you can set the control it points to using the Control Name property.  You can create the local variable on the main block diagram or you can create it on the diagram of the case structure.  You do need to specify a particular diagram for the case structure, not just the case structure.  Move commands are always relative to the main block diagram, so make sure you move it to a visible spot in the case structure or weird things could happen while wiring.

Message 3 of 5
(3,494 Views)

I do not see a control name property for the local variable.  Are you sure you're not thinking of the standard creation of a local variable, vs. the labview scripting approach I am taking?  In other words, the VISA Property Node has various properties I can choose from...one of them is Label.Text.  Others are Icon, Description, Position, etc.  Control Name is not one of them.

0 Kudos
Message 4 of 5
(3,452 Views)

Nevermind, now I understand.  The invoke method keyword really helped me out.  I've got a 95% solution now so I'll continue figuring out the last 5%.  Kudos to you both!

0 Kudos
Message 5 of 5
(3,444 Views)