02-09-2022 11:52 AM - edited 02-09-2022 11:55 AM
@Dr_Daryl wrote:
Hello altenbach! I will attempt to answer your questions:
You are basically writing a graphical version of text based code, defining all "variables" using all terminals disconnected inside a stacked sequence, then pushing all data around using value properties. This is extremely inefficient, because property nodes are synchronous. Most likely you force orders of magnitude more thread switching compared to properly written code.
All these very deeply stacked sequences just give me the creeps!!!
Sorry, this code is so far out of my comfort zone that I won't be able to provide much assistance.
In any case, since that label array is static at runtime, that code belongs before the toplevel loop, to be run exactly once. It has no business in inner code.
02-09-2022 12:10 PM
You are correct! Using the property nodes and stacked sequences, novices who may need to change the code can very easily locate and update information in the code. The alternative would be to string wires all over the place, making the code look like a spider web of shift registers and tunnels. Or, I could cluster the data and pass it to the states in the queue, which is how I started to do it. But then the customer kept adding in more and more inputs. Each time I added something to the cluster, the program would break because there were now unwired terminals that had to be handled. It became a nightmare so I went with the good old property nodes to move the data about without any wires.
Oh, and you're correct- the label array could have been defined in the initialize state (which is already about 15 stacks deep), but I thought it better to move them to the state where they are used. But- I suppose I could move them back to the initialize state and bury them way down deep in a 'creepy' stacked sequence.
But what would be helpful is if someone told me what 'properly written code' means? If it works, and the machine is fast enough to not care about number of threads or memory, is there any harm done in doing it this way?
02-09-2022 02:10 PM
@altenbach wrote:
@billko wrote:
Big guess, but I'm guessing these will become headers in some report or something of that nature, and the headers would then change if a change was made to the labels of the controls.Then I would probably iterate over an array of references. Still seems overly complicated. 😄
No matter what, I would probably also use the legend instead of the label.
I would do an array of refs as well. This was the best scenario I could come up with, though.
02-09-2022 03:54 PM
@Dr_Daryl wrote:
WHAT IS THIS MAGIC?!? The Quick Drop Window has the ability to wire stuff? Why don't they call it a "Quick Method" or "Shortcut Window"? I assumed the Quick Drop was just for controls and operators. I will have to find some training on all that thing does now!!
Thank you for answering my question and taking the time to illustrate. I hope this helps other young Padawans who have never used the Force in Labview yet!!
You can actually add your own stuff to the quick drop menu as control-key shortcuts. There's an entire forum called Quick Drop Enthusiasts on here for people who made their own. I put one up on there back in 2017 to more easily add "Value change" events for controls to event structures, though it's less useful now that there's a "Create -> event case" right-click option on controls (there wasn't when I created mine). There's plenty more up there that you could also consider adding to speed up (and/or remove tedium from) your development time.
02-09-2022 05:08 PM - edited 02-09-2022 05:22 PM
@Dr_Daryl wrote:
But what would be helpful is if someone told me what 'properly written code' means? If it works, and the machine is fast enough to not care about number of threads or memory, is there any harm done in doing it this way?
your coding style kinda reminds me of this...