LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically find out callers

Hi all,

I would like to ask, whether it is possible to programmatically find out callers of certain VI in project, just like Find - Callers in project tree does.

0 Kudos
Message 1 of 21
(5,628 Views)

Hi Rashek,

 

have you tried to read the CallChain?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 21
(5,608 Views)

I believe Rashek is looking for all of the callers of the VI, not the call chain.

 

Try the 'Callers' property node. Wire the VI reference to a property node and there are two properties - 'Callers Names' and a 'Callers Paths' that should get you what you are looking for, if I understood correctly. 

 

Edit - the 'Callers Paths' is a private property, however you should be able to use the 'Callers Names' property without any additional work. 

0 Kudos
Message 3 of 21
(5,591 Views)

The callers of a VI only gives callers in memory, while the callers in the project returns all callers I the project, including VIs that are not in memory. You'd need scripting on the project to get that information.

0 Kudos
Message 4 of 21
(5,586 Views)

Exactly, that´s what I am looking for - scripting function which would allow me to find all callers inside project. I thought that maybe getting project reference and using some property/method from there... however, as far as I know there is no way to get project reference from a VI, so I am looking for an alternative solution.

0 Kudos
Message 5 of 21
(5,556 Views)

Well, you can start by getting the project which owns the VI.

 

Scripting - Find VI Project.png

 

This code illustrates the difference between "OwningProject" and "ActiveProject".  If you have more than one project open, selecting one project window over another will alter the value of "ActiveProject*" but "OwningProject" will remain the same (assuming you add the running VI to one of the projects).

 

Never mind the terrible reference handling..... just a 1 minute illustration VI. Smiley Embarassed

0 Kudos
Message 6 of 21
(5,546 Views)

I already tried this, the problem I have with this approach is that if VI is part of library, you get only reference to given library. What I would like to do, is to get reference to the entire project, so that I can find callers even outside library

0 Kudos
Message 7 of 21
(5,540 Views)

Are you sure the VI Property "OwningApp" gives back a library reference?

 

The type of the VI Server reference is of type "Application", which seems seriously incompatible with giving back a Library reference......

 

Edit: I just tried putting the VI in a Library, still worked fine.  I got back a reference to the owning project.

 

Edit 2: Do you have the VI in a PPL by any chance? No idea how that would affect things.

0 Kudos
Message 8 of 21
(5,536 Views)
0 Kudos
Message 9 of 21
(5,522 Views)

Hmmm, project Item from Ref. I need to re-activate the supersecret INI setting.....

0 Kudos
Message 10 of 21
(5,519 Views)