11-28-2020 11:48 PM
Does anyone know how to intialize a gvi beofre it runs in NXG?
Solved! Go to Solution.
11-29-2020 02:08 AM
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?
11-29-2020 02:17 AM
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.
11-29-2020 05:28 PM
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.
12-01-2020 01:53 AM
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?
12-01-2020 02:35 AM
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.
12-01-2020 05:29 AM
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.
12-01-2020 07:47 AM - edited 12-01-2020 07:50 AM
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! 😄