From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create Constant VI Reference Type

I don't know if this is a possible bug, or just unintended usage.  I am making some VIs using scripting, and I need to make a VI that has a constant that describes the type of a connector pane which goes into the Open VI Reference Type terminal.  I get this VI reference from a terminal of a subVI and the type is not known and can change.  This is fine and when it does I want my code to go and create the VI reference constant again with the new connector pane settings.

 

When I create a constant off of the Open VI Reference terminal I specify the constant with a variant but when the constant is made it looses its strict-ness on the constant and is now just a normal VI reference.  But if I use the private scripting function on the block diagram giving the same variant data type, the constant is made and the strictness is preserved.  Is this a bug?  Attached is a VI that demonstrates the difference between the two methods.

0 Kudos
Message 1 of 3
(3,080 Views)

It's not a bug; but expected behavior.

With the "Create Constant" method for the diagram, what you're feeding in is the "DataType".  So the method creates that data type.

With the "Create Constant" method for the terminal, what you're feeding in is the data "value" only.  The type is taken from the terminal.  The result is exactly the same as if you had right-clicked on the terminal and created a constant.

 

"If you weren't supposed to push it, it wouldn't be a button."
Message 2 of 3
(3,025 Views)

...okay I guess I can agree with your reasoning.  I would just expect that if I'm creating a constant and I give it a variant, then it would make a constant of that type I passed.  But obviously this only takes the value, and it gets the type from the terminal.  Guess I'll be using the private method of creating a constant of the type I want.

0 Kudos
Message 3 of 3
(3,010 Views)