LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a reference to a Project Library?

Hello DSC 8 users,

In my project I have couple project libraries ( *.lvlib) defined, containing only shared variables. I want to logg those variables to Citadel, but I need to programmatically set datalogging properties for each library, like Database Computer, Database Name and path etc.

My problem is that I can not get the reference to a particular library, because ther is no VI inside. Is there any way to get the reference to a library based on Shared Variable name that is inside the Library?

I tried different approaches, the closest that I came is to store a VI inside the Library, get the reference to this VI and from tis reference I can get to Library property that I need.

But in case there is no VI inside, I can't do it. I'm sure there is a solution to this. Can somebody please help?

Thank you,

ROMP
0 Kudos
Message 1 of 7
(8,156 Views)

ROMP,

In order to get a reference to a particular .lvlib and it's contents, you must use the VI's on the application control palette.  In particular, you can use an invoke node that takes the path to your .lvlib file as input so you can get a reference directly to that LV Library file within your project.  Then you can use a property node to look at the "children" within that .lvlib file.  Index whatever "child" you want to affect and you can get and set properties, and in your case, get a reference to the shared variable within that library.  Refer to the shipping example called "Add Files to Project" to get an idea of how to use the VI's on the application control palette in this way.  Best of luck!

Message 2 of 7
(8,134 Views)
Mark,

thank you for your post. As happened to me once before, I was a bit to quick posting my question. After some further investigation and example study, I found the answer to my problem.
As you described in your message, the key function that I missed is Invoke node, using Library.Open method that gives you Path input. I searched only among the properties and that's why I didn't find the correct one. Of course, first you must use Open Application Reference function.

Hope this will help somebody else. It's great to know there is a comunity of LV users out there, willing to help.

Thanks again,

ROMP


Message 3 of 7
(8,110 Views)

Hi, 

 

i might be overlooking something here, but i can only seem to open a vi refenece and not a "library" reference. when i use the "open VI reference.vi" from the programming->application controll menu it throws an error at me.

 

currently i have worked round this by using a member of the lib to then get its "library" property and do what i want from there. However this isnt the best way for me as i want to be able to start with just a .lvlib file path and then document information about this library.

 

Any help on how to open a ref to a .lvlib dirrectly would be fantastic.

 

Chris

0 Kudos
Message 4 of 7
(7,307 Views)

You need to open an application reference, rather than a vi reference. You can the select the method Library.Open which takes the path to the library and returns a reference to it.

 

MC

0 Kudos
Message 5 of 7
(7,298 Views)

Digging up an old thread

Is there any way to do the same, but for a library/class that has not yet been saved and only exists in memory?

0 Kudos
Message 6 of 7
(6,011 Views)

This method seems to work for unsaved libraries and classes well:

Application class Invoke node: Library.Get Ref By Qualified Name

LabVIEW_2018-09-28_11-48-16.png

Message 7 of 7
(5,999 Views)