LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically find items with no callers

In a LV project, you can right-click the project itself in Project Explorer and select "Find Items with No Callers". This feature, incidentally, is a bit crude as of now, because of the lack of features when the screen pops up with the results. More on that later. However, what I want to be able to do is to perform this action programmatically using VI Scripting. I can open a reference to the project by climbing up out of a Current VI's Path call as follows

 

Get Project Refnum.png

 

However, when I slap on an Invoke Node with the Project.ActiveProject output as the reference input, the "Find Items with No Callers" is not available. I was under the impression that with LV Scripting, all right-click menus can essentially be called programmatically. Is this not the case? Is there a way to do what I want? The Property Node doesn't fare any better in terms of getting me what I want.

 

The end goal for me is to prune legacy code out of the project so as to simplify things a bit. However, I've found the "Find Items with No Callers" to be a bit unhelpful for the following reasons:

 

1. The results are not sortable in any way.

2. The window that opens has the focus and cannot be minimized. 

3. There are many results that come from vi.lib - this makes no sense to me. This right-click option should only return VI's in the project's directory structure on disk that are not called by any other VI. 

 

I realize these things have been said before, but nothing has been said recently. 

 

So, I wanted to wrap this "Find Items with No Callers" around a bit of code that would make it more useful. 

 

Ideas?

Adrian C. Keister, Ph.D.

Certified LabVIEW Architect
Certified Professional Instructor

B.S. in Applied Physics/Computer Hardware and Software Systems, Mathematics, 2001, Grove City College.
M.S. in Mathematical Physics, 2004, Virginia Polytechnic Institute and State University.
Ph.D. in Mathematical Physics, 2007, Virginia Polytechnic Institute and State University.
0 Kudos
Message 1 of 11
(3,248 Views)

Find:Items with No Callers is a property of project items, not the project itself.  You can find such things using the Class Browser (View»Class Browser or Ctrl-Shift-B).  You will need to iterate through your project items, but this will also let you skip such things as the dependency folder.

 

ItemsWithNoCallers.png

Message 2 of 11
(3,244 Views)

Almost sounds like you want to develop what can be done with a source distribution.

 

Create source distribution and include the top-level and dynamic VIs in ti along with any support files you need.

 

Configure it to preserve the hiarchy and point at a new folder.

 

When the SD is built it will pick-up all of the VI's and called sub-VI and relink them in the new location. Anything not used will be left behind.

 

Copy the proj file to the new location and you should only find stuff that is used in the new folder.

 

Ben

 

PS Just notice this is a Physics only thread so far. BTW My wife graduated from Grove City

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 11
(3,229 Views)

Ben: how does your procedure change, if at all, for a real-time project? Perhaps I should have mentioned up front that this was a real-time project with a cRIO controller and EtherCat expansion chassis.

Adrian C. Keister, Ph.D.

Certified LabVIEW Architect
Certified Professional Instructor

B.S. in Applied Physics/Computer Hardware and Software Systems, Mathematics, 2001, Grove City College.
M.S. in Mathematical Physics, 2004, Virginia Polytechnic Institute and State University.
Ph.D. in Mathematical Physics, 2007, Virginia Polytechnic Institute and State University.
0 Kudos
Message 4 of 11
(3,218 Views)

As long as you have the top lveles of all in the SD, it should work fine.

 

You WILL of course backup everthing BEFORE you test it out. Smiley Tongue

 

BTW: This has been a physics only thread.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 11
(3,213 Views)

Ben,

 

So do I do a SD under the RT target? Or do I do a regular one under the project?

 

If by "physics-only" you mean all the posters are physicists, that's interesting. So DFGray is a physicist? 

 

When did your wife graduate from Grove City College?

Adrian C. Keister, Ph.D.

Certified LabVIEW Architect
Certified Professional Instructor

B.S. in Applied Physics/Computer Hardware and Software Systems, Mathematics, 2001, Grove City College.
M.S. in Mathematical Physics, 2004, Virginia Polytechnic Institute and State University.
Ph.D. in Mathematical Physics, 2007, Virginia Polytechnic Institute and State University.
0 Kudos
Message 6 of 11
(3,209 Views)

Down at the bottom where the builds are located.

 

She graduated about 1983 I think.

 

Yes DF is also a member of Sigma Pi Sigma but he actually participates while I just give them cash.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 11
(3,207 Views)

Sorry, I'm still not following. Should I do the build specification under Option A or Option B (See attached screenshot.) 

 

Option A or B.png

Adrian C. Keister, Ph.D.

Certified LabVIEW Architect
Certified Professional Instructor

B.S. in Applied Physics/Computer Hardware and Software Systems, Mathematics, 2001, Grove City College.
M.S. in Mathematical Physics, 2004, Virginia Polytechnic Institute and State University.
Ph.D. in Mathematical Physics, 2007, Virginia Polytechnic Institute and State University.
0 Kudos
Message 8 of 11
(3,203 Views)

Sorry!

 

I have to confess I have not been working with the RT targets lately since my co-workers get to play with those, so I would suggest you do a SD for each.

 

It may be possible to do just one but that could goof with some linking differences for the two targets.

 

Please report back if you find anything to indicate that approach is not working. That is how we keep up on the tricks and techniques as they change for LV.

 

Take care,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 9 of 11
(3,195 Views)

Ben,

 

Thanks for that. As for backup, I have TortoiseSVN, so I'm all set.

 

DFGray, I'm having trouble opening references to ProjectItems. How can I do that?

Adrian C. Keister, Ph.D.

Certified LabVIEW Architect
Certified Professional Instructor

B.S. in Applied Physics/Computer Hardware and Software Systems, Mathematics, 2001, Grove City College.
M.S. in Mathematical Physics, 2004, Virginia Polytechnic Institute and State University.
Ph.D. in Mathematical Physics, 2007, Virginia Polytechnic Institute and State University.
0 Kudos
Message 10 of 11
(3,179 Views)