LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically find out callers

It's weird, but the practical way to get a project item from a ref is with a brown nodes (not to be confused with the brown note). Without that, I think all project items need to be recursively checked for a Vi with matching name.

0 Kudos
Message 11 of 21
(2,268 Views)

Well, that Project Item From Ref. property node doesn´t work fom me, since I get error 56004: Project item cannot be found

0 Kudos
Message 12 of 21
(2,262 Views)

@Rashek wrote:

Well, that Project Item From Ref. property node doesn´t work fom me, since I get error 56004: Project item cannot be found


Post your code. Something is wrong... Not 100% sure about the application\project construction. Place probes to see what property\method fails. Any change you have two projects open?

0 Kudos
Message 13 of 21
(2,253 Views)

Is the VI even listed in the project?

 

Which application instance is the VI in (Bottom-right corner of the FP).

 

I ask again: Is the VI in a Packed Library?

 

Is the VI inlined?  Give us some information where we might be able to help........

0 Kudos
Message 14 of 21
(2,243 Views)

Has anyone found a solution to find all callers of a VI ?

 

- There is a "Find Callers" property on the ProjectItem, but it throws error 1: "An input parameter is invalid."

- "Callers' Names" and "Callers' Paths" VI properties only return callers in memory.

 

The only solution I see is opening all VIs in the project 1 by 1 and traversing their diagram to search the specific SubVI, which is very slow for a big project !

A bit frustrating because the right-click function "Find->Callers" is almost instantaneous, so LV must store callers lists somewhere...

0 Kudos
Message 15 of 21
(2,073 Views)

I managed to make the "Find Callers" property work.

(apparently, it does not work when the ProjectItem is obtained from the descendants of a library opened with "App->Library.Open", you must obtain the ProjectItem from a project refnum).

 

Unfortunatly, this method still only returns callers IN MEMORY, which is never indicated in its documentation :

"Returns an array of references to all project items that reference the project item you select.

This property is similar to the Find»Callers item on the shortcut menu of a project item."

 

This problem reminds me of the "Find" tool that only searches for text in loaded VIs, so that you only get half of what you are searching for.

NI should specify clearly when a function only operates on VIs in memory and warn you that you may miss some instances...

...or make these functions work for all VIs (loaded or not).

0 Kudos
Message 16 of 21
(2,064 Views)

@raphschru wrote:

I managed to make the "Find Callers" property work.

(apparently, it does not work when the ProjectItem is obtained from the descendants of a library opened with "App->Library.Open", you must obtain the ProjectItem from a project refnum).

 

Unfortunatly, this method still only returns callers IN MEMORY, which is never indicated in its documentation :

"Returns an array of references to all project items that reference the project item you select.

This property is similar to the Find»Callers item on the shortcut menu of a project item."

 


I would expect that probably it's not possible to detect all Callers of an item that are not in the project/memory. How would that work? Suppose I (on your computer) create a new VI which calls your VI, and save it somewhere else (different project, different directory etc).

Unless my new VI in some way changes your VI (which probably you don't want) it can't be found unless it's in some predetermined list of things to check through (which I'd guess is some sort of linker list when you run the method you have inside the project).

 

Does the "Find >> Callers" item work differently? i.e. will it find my hypothetical unloaded VI in the case described above?

 


@raphschru wrote:

This problem reminds me of the "Find" tool that only searches for text in loaded VIs, so that you only get half of what you are searching for.

NI should specify clearly when a function only operates on VIs in memory and warn you that you may miss some instances...

...or make these functions work for all VIs (loaded or not).


Clearer documentation is always a good thing. Perhaps you could submit a support request for this if you have a concrete issue (not sure if it will help, but...)


GCentral
0 Kudos
Message 17 of 21
(2,048 Views)

Right clicking a VI in a project, Find>Callers, does return VIs that are not in memory.

 

So there is a way.

 

My guess would be LabVIEW runs the "Application.Linker.Read Info From File" method for all VIs and stores that information in some sort of graph (or graphs). The menu can simply look up the dependencies from that graph.

 

LabVIEW has the luxury of being able to maintain that graph while you're editing. If you want to apply the same trick, you'd need to create the graph each time you need it, which will probably take a while.

0 Kudos
Message 18 of 21
(2,025 Views)

Apologies for reviving an old thread, can somebody tell me how to enable the "Proj Item From Ref." project property? I have searched up all the "secret" ini settings and enabled them, but I still do not see a property that allows me to enumerate project items

 

Best regards

0 Kudos
Message 19 of 21
(1,858 Views)

@laksafan wrote:

Apologies for reviving an old thread, can somebody tell me how to enable the "Proj Item From Ref." project property? I have searched up all the "secret" ini settings and enabled them, but I still do not see a property that allows me to enumerate project items

 

Best regards


1) I'm not sure which ini key needs to be set... It should be here:

Get Project Item From VI Ref invoke node.png

 

2) On a project invoke node (QD on an invoke node, type Project, CTRL+B), type "get project item from vi ref", then CTRL+SHIFT+B. This will works without the right ini file.

 

3) If you have the right ini file key set, it should be visible in the class browser as well.

 

4) Here's a snippet:

Get Project Item From VI Ref.png

0 Kudos
Message 20 of 21
(1,847 Views)