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: 

How to programmatically add UDVs to project?

Hi all,

 

I have successfully used something like this to programatically add shared variables to an LVLIB (the code assumes that the library associated with the Container Reference contains at least one variable):

Programatic Variable Add.png

 

An example output would be:

  • Container Name: "MyLibrary.lvlib"
  • Variable Name: "Variable1"
  • Variable Path: <blank>
  • Variable Type String: "Variable"

(I notice that there is no way to specify the data type of the variable, and LabVIEW creates a DBL variable in the LVLIB by default.)

 

 

However, if Container Reference is associated with a "User-Defined Variables" container, then I get Error 1 at the Invoke Node ("LabVIEW: An input parameter is invalid"). A example output is:

  • Container Name: "User-Defined Variables"
  • Variable Name: "Variable1"
  • Variable Path: <blank>
  • Variable Type String: "Variable"

 

Questions:

  1. Does the error occur because LabVIEW is trying to create a DBL variable (which is not allowed with UDVs)?
  2. How can I programmatically add UDVs to my project?

 

Thanks in advance!

Certified LabVIEW Developer
Message 1 of 5
(2,836 Views)

What is the scope of your project? How will you be using these UDV's?

0 Kudos
Message 2 of 5
(2,795 Views)

Hi!

Did you find any solution?

I have exactly the same problem....

Thanks for your answer...

0 Kudos
Message 3 of 5
(2,225 Views)

@kabooom wrote:

Did you find any solution?


Unfortunately, I didn't find a way to add UDVs to a LabVIEW project via VI Scripting, and I stopped trying.

Certified LabVIEW Developer
0 Kudos
Message 4 of 5
(2,222 Views)

thanks for your quick answer... 

Nobody from NI ? or a labview champion here ?

 

For my test i have something like 256 user variable to create, and i thought it will be easier doing that programatically...  I don't understand why u can't do that in the project , there is a multiple variable editor, but you can't add multiple variable at once, you have to create them one by one... maybe it's linked with the fact you can't do that programatically...

0 Kudos
Message 5 of 5
(2,217 Views)