04-23-2007 02:30 PM
@Tomi M wrote:
To subfolder user.lib\_OpenG.lib\constants folder as Merge VIs.
I don't understand that one. The whole point of a const is to be the same everywhere. Using the merge function will simply drop a literal constant.
Your first suggestion sounds like a potential step in the right direction. Perhaps writing a toolkit to assist in the generation of constant VIs (name + icon + documentation?) would make it easy enough?
Personally, I find that the hardest part is the icon because constants can have long names and an icon doesn't have a place to conveniently hold the text.
Albert, I think a constant should be a constant, not a loadable resource. As such, it should have no possibility for run-time errors and should not be dependant on the data flow. It should simply return its value. I understand the usefulness of error handling, but that simply would not be a const.
In this case, I can return to my optional implementation of having the constant VI have a block diagram and forcing it to execute when it loads. There are issues with that, though.
As a side issue, if I understand correctly, there is no real need for a change to a global VI to cause a recompile to all the VIs calling it. If a global variables has two numerics (A and B) and I multiply them in another VI and I then add another numeric (C), the VI using A and B should not have any real reason to recompile. Yes, the list of options changed, but the selected options did not, so that's an editor issue.
04-23-2007 02:43 PM
04-24-2007 07:17 AM
04-24-2007 08:38 AM
04-24-2007 08:43 AM
"The control freak in me does not like the idea that someone else could mess with my data."
I can relate to that. I'll often put error checking into my sub-VI that clearly "blame" the caller if misused.
Ben
04-24-2007 08:44 AM
04-24-2007 08:58 AM
@Ben wrote:
Reply # 35 of the NI link brings it all together in the context of history. So I still think the answer is "False".
I'd still really like to see the relase note that tells us when this changed. I'd also like to see some more technical documentation, rather than just a post in a forum (no offense to JLS - but this is an extreeemly important point that I'd like to see officially clarified once and for all).
04-24-2007 09:16 AM
Hello all
this thread has been very interresting to me.
however, several issues: to my understanding, global variable are a viable option, also to keep constants. but not only. imagine a situation where a caller routine wants to add an input to a way under first layer subvi (far down in the tree). transfering this variable trough all caller subvis isn't an elegant option at all. the utilisation of global then become necessary. the only question: what is the value of the global before actually writing to it? only "make current value default"?
that lead to my second tought: is there a way to tell labview to automatically make value defaults everytime one closes the VI? i am talking of the main vi and not the subvi called, which can be saved using a method call.
Thanks guys
04-24-2007 09:23 AM
Hi Gabi1,
Please see teh Action Engine Nugget for an alternative to globals.
Ben
04-24-2007 09:56 AM
Ben i have just read about type def along with AE...
this is really too bad i didnt read that 2weeks ago. i built up an enormous piece of control system, in which i had big trouble keeping my data type trough all subvis (especially each time i decided to change some of it in my clusters...).
well, good to keep in mind tough. those are very nice nuggets you delivered. Thanks