LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional disable structure: is it somehow possible to select a case depending on parent (calling) VIs?

I have a subVI I use for logging that can be called from anywhere in the rest of a program. At call I can also set parameters like "prepend timestamp" or "prepend callchain". I would like to use this logging subVI in another program (in the same project; will both be independent exes on different computers at some time, communicating with each other via network). The only difference is the way I get the reference to the logfile the entries should be written to (the files are opened at the start of the program).

 

One solution would of course be to feed the reference from the outside. But this means that at every call I somehow have to get the reference in the calling VI, something I'd like to avoid.

 

Another solution would be to check the callchain within the log-subVI and, depending on the "root" VI, call another subIV in a case structure that returns the appropriate reference. Using this method both versions would be compiled into the program, although only one of which will ever be used in one of the programs. I'm not l logging at any high rate, so the additional code to execute and the optimizations the compiler can't make because of the conditional, wouldn't really pose a problem.

 

Still I'd like to know if there's a way something like the conditional disable structure can be done, but with the enabled diagram depending on the calling VI and not on one of the conditional symbols set for the whole project (my programs are in the same project).

0 Kudos
Message 1 of 3
(2,191 Views)

What you are asking for sounds like something that would be provided by using object oriented programming within LabVIEW.

Message 2 of 3
(2,185 Views)

Just had some more thoughts about it (as it happens when you leave the PC for an hour) and came to the conclusion that what I want is impossible. Since the compiled code is part of every VI there can't be two different compiled versions at the same time, I guess. But I'm definitely not an expert in Labview, so if someone has an answer I'm still open for suggestions. I haven't done much with LVOOP till now, and since this logging is such a small part of the whole project, currently it's not the place to invest too much time.

I'm tending to make wrappers, that just get the according reference and then call the common code.

0 Kudos
Message 3 of 3
(2,173 Views)