From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with autoindexing array of boolean indicators.

Solved!
Go to solution

@altenbach wrote:
You really (really!!!!!) need to start over. There should be absolutely no need for references and local variables at all! This is just all complete Rube Goldberg!

See if this can give you some general ideas. (Yes, it does something else, but the principle is the same)

 

altenbach_0-1680887340597.png

 

0 Kudos
Message 11 of 31
(643 Views)

In this project I cant just use arrays because I use custom controls with .gif images and the animation glitches out when inside an array so I have to use each of the indicators uniquely. Are you sure there is no other way to measure an element of those arrays of references inside that case with property nodes?

0 Kudos
Message 12 of 31
(617 Views)

You can code in arrays and have a big transparent cluster on the front panel containing all your custom booleans. Then just convert cluster <> array for display.

 

0 Kudos
Message 13 of 31
(606 Views)

@Seiryuu90 wrote:

In this project I cant just use arrays because I use custom controls with .gif images and the animation glitches out when inside an array so I have to use each of the indicators uniquely. Are you sure there is no other way to measure an element of those arrays of references inside that case with property nodes?


Probably there is BUT, I would do it with an Event structure.  You would create a value change event for your last ( end trigger) boolean reading the new value node and the new value with your rectangular ( end enable) boolean, set as "switch when released", to exit the Event loop.  You would also create either a value change event for left value change, right value change and execute Altenbach's code there or in a timeout event.  


"Should be" isn't "Is" -Jay
Message 14 of 31
(604 Views)

Thank you for your reply but unfortunately I dont get much of what you described. I know somethings about event and how to set a value change but I lose you at the part you're talking about the "end trigger" and "end boolean" stuff. I am kinda new to this software.

0 Kudos
Message 15 of 31
(598 Views)

@Seiryuu90 wrote:

Thank you for your reply but unfortunately I dont get much of what you described..... I am kinda new to this software.


The problem is obviously inexperience and looking at your code you are just piling on completely wrong code constructs, creating an unmaintainable house of cards. You might get it to work eventually, but there is no elegance. All that could be done with 10% of the code using no local variables and no references at all.

 

I get the feeling that you are an experienced text programmer. Nothing wrong with that! You need to forget all the bad habits that you acquired by trying to blindly apply concepts from text languages to a highly parallel dataflow language (For example, LabVIEW has no "variables"! The wire is the variable! Local variables are just secondary access to UI elements). Start with the learning resources listed at the top of the forum. Look at the examples and design templates that ship with LabVIEW.

 

So far, this all looks like an experienced auto mechanic trying to do heart surgery using a socket wrench and screwdriver. It's just not right!

 

There are no shortcuts to learning the basics!!!

....

Hmmm.... Well, there are actually shortcuts! Start by attaching your code so we can see the UI (they can be plain LEDs at this stage, you can substitute custom controls later). Then explain step by step what the user does and what should happen as a function of user interaction and time. Code pictures are completely useless. (To keep the auto mechanic analogy going, except for rare cases, we cannot tell from a picture what's wrong with the car). Yes, to most of us, your LabVIEW code looks as follows... 😄

 

altenbach_0-1619056360492.png

 

 

Message 16 of 31
(569 Views)

@altenbach wrote:

You can code in arrays and have a big transparent cluster on the front panel containing all your custom booleans.

 


Here's how that could look like:

 

altenbach_0-1680971637857.png

 

You still need to learn about clusters and cluster order, for example. All the basics!

 

Message 17 of 31
(561 Views)

@Seiryuu90 wrote:

Are you sure there is no other way to measure an element of those arrays of references inside that case with property nodes?


On a side note, "measure" is the wrong term here.

Indicators are just passive UI elements that display whatever is wired to them, so the data value you are interested in is in that wire leading to it. Indicators are not meant to be abused for data storage as you seem to do (Yes, they do have their own memory and transfer buffer because the UI handling is asynchronous. This also means that every local variable creates additional data copies in memory). Once you start using value references and local variables, their value depends on whatever wrote to it last, which is completely undetermined in your code. All your disconnected "code islands" execute in random order or even in parallel (If you have multiple cores as most do). Only wires can define execution order and you always know where the data comes from and where it is going. In very rare cases, sequences structures can be use to further enforce a certain order if really needed.

Dataflow is a very powerful paradigm: Just follow the wire!!! Once you realize the power AND elegance of it, you'll never go back to text programming. 😄

Message 18 of 31
(520 Views)

Thank you for the information and your advice! But I'd like to learn a way for this particular block diagram (autoindexed array) to just read the value when the last boolean is true.

0 Kudos
Message 19 of 31
(484 Views)

@Seiryuu90 wrote:

Thank you for the information and your advice! But I'd like to learn a way for this particular block diagram (autoindexed array) to just read the value when the last boolean is true.


Delete from array will give the last element as removed per default. Or, as Altenbach said, use the end reference of the loop.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 20 of 31
(480 Views)