LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

initialize a gvi before it runs

Solved!
Go to solution

Does anyone know how to intialize a gvi beofre it runs in NXG? 

0 Kudos
Message 1 of 8
(2,059 Views)

Maybe you should explain in more detail what you mean by "initialize". (Clear indicators? Clear controls? Reset controls to defaults? Clear data in uninitialized shift register? Clear data in charts? Something else?  etc.)

 

Also when exactly is "before" it runs? Do you mean as a first step when it is run?

0 Kudos
Message 2 of 8
(2,031 Views)

Yes. I would like to reset controls to defaults and clear indicators as the first step when it runs. I used following method in LabVIEW 2109, working fine (https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YH0zCAG&l=en-AU). But couldn't convert it to NXG.

0 Kudos
Message 3 of 8
(2,025 Views)

I would just initialize them explicitly.  I do this in Classic and NXG.  I never rely on default values because it's too easy to change them either accidentally or without knowledge of understanding the ramifications.  Changing a constant value, though, takes deliberate intent.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 8
(2,001 Views)

What troubled me was "How to clear all controls in initialization using VI reference?". I can clear a single control using its property node. But if there are 10 or more (or even >20) controls, it will be tedious to do one by one. Is there any way I can use VI reference to reset all the controls in the (g)vi?

0 Kudos
Message 5 of 8
(1,977 Views)
Solution
Accepted by LAL21

Many times, "safer" = "tedious", but to your point, I don't think there is - not directly.  Make an array of references and use the Reinitialize to Default node in a FOR loop.

 

That NXG is still in the "toddler" stage, combined with critical design choices I don't agree with, has made me shy away from NXG for the foreseeable future.  It's too bad, because I really, really wanted to make NXG work for me.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 8
(1,973 Views)

Thanks. Your solution (build an array and pass it to a for loop) is pretty good. I really like NXG, it makes LabVIEW coding simpler. The interface looks great as well. 

0 Kudos
Message 7 of 8
(1,964 Views)

My experience was that NXG actually makes coding more difficult as your coding gets more complex.  (And it renders over half of the OpenG library untranslatable.  I actually downloaded the source code to see what was broken in the translation.  Only a couple of libraries made it through, and it seems no one is working on it at the moment.)

 

There's annoying stuff, like there's no "hide full names" for unbundling, making some of my VIs a lot "longer" than it needs to be.  But then there are some critical decisions - like wires can no longer carry properties - that make it impossible to do certain tasks.  You can't get the name of a control from a variant, for instance, which puts an end to using that function to easily create key value pairs.  (Maybe that's why LabVIEW Classic has the mapping functions now.)

 

I tried to like NXG because it felt like "LabVIEW after thirty years of consideration", but it just didn't turn out to work for me.


Edit:
You thought you've seen sprawling block diagrams before; I'd like to see what happens when NXG becomes more popular and novice coders find the "zoom" feature!  😄

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 8
(1,951 Views)