12-23-2021 04:32 AM
Hi,
I have an array that contains 120 elements in it, now I want to show 80 values from that array in the front panel with separate indicators for each value. I can use index array but that would make my code very big, I want some simple solution for it. Does anyone have any idea on how to do it?
12-23-2021 04:52 AM
Hi rk,
@rk0001 wrote:
I have an array that contains 120 elements in it, now I want to show 80 values from that array in the front panel with separate indicators for each value. I can use index array but that would make my code very big,
Having 80 individual indicators in the frontpanel also means to have 80 individual terminals in the block diagram: why do you worry about a single IndexArray node in the blockdiagram???
@rk0001 wrote:
I want some simple solution for it. Does anyone have any idea on how to do it?
IndexArray is the simplest way to get the array elements…
A somewhat scalable way would be to label all of those 80 indicators in a very distinctive way like "arraylabel#000" (where "000" is the index of the corresponding array element). Now you could use the frontpanel reference to get references of all frontpanel elements, filter for the indicator references, use their label to get the corresponding element from the array and then set their value using a "value" property node. (Keep in mind: you can always show a different caption instead of the label.)
12-23-2021 05:05 AM - edited 12-23-2021 05:10 AM
There are certainly use cases for this. However, can be a terrible way to get things done.
I hope you know what you're doing.
Create one indicator, label it "Something 0".
Copy it to, to get "Something 1"
Copy it to, to get "Something2"
Copy it to, to get "Something3"
Copy those 2 times, to get 8, copy those 10 times to get 80.
Now, use VI Server to get references to those controls, and to set their value:
Obviously, you can get the references from controls on a pane, a tab page, a cluster, etc.
If you cast the control references to the specific type of reference, you loose the variant.
EDIT: Use "Something [0-9]+" in stead, \d only works in a reg.ex, not a match pattern.
12-23-2021 05:20 AM
wiebe@CARYA wrote:
There are certainly use cases for this. However, can be a terrible way to get things done.
I hope you know what you're doing.
To elaborate a little.
I have panels with configuration items where I get\set values by reference. I definitely don't want to wire dozens of terminals and locals manually.
If the configuration name doesn't suit you, show the caption to the user, and use the label in the diagram.
Also have a few situations like yours. A few dozen indicators. So why not use an array? Customer want to set individual properties of the items (sometimes incl. position), and in an array there's only one control type, so you can't change properties of individual items. Values not included of course.
I do put these items in a cluster when possible. However, if several clusters have overlapping regions on the front panel, the front most cluster blocks clusters behind it. Viewing the items isn't a problem if the cluster is transparent, but mouse interaction is blocked.
So, I won't say you shouldn't do it, but there are consequences to this technique... For instance, the value property node is in sync with your screens refresh rate. This makes it slow. For 80 items, I wouldn't worry about it too much, but it's a concern.
12-23-2021 07:35 AM
As already suggested, put your indicators in one (or more) cluster. Then use Array To Cluster to set in a single node (or as many nodes as the number of clusters). This is a lot easier especially if your source values are grouped together, that is if values to be shot into each cluster are adjacent in the array, allowing you to extract them by Array Subset.
12-23-2021 07:39 AM
While the solutions mentioned are good, I think all of us need to know what your use-case is for having 80 separate indicators. It's not clear as to why you need so many.
Can you elaborate?
12-23-2021 07:52 AM
Just reshape it to a 2D array and show that. Make it 6x20 and show 4 rows.
12-23-2021 10:32 AM
@Yamaeda wrote:
Just reshape it to a 2D array and show that. Make it 6x20 and show 4 rows.
I would go one more step and use a table indicator. Now you can even do some custom formatting or at least guide the eye by various background tints.
12-23-2021 12:17 PM
@altenbach wrote:
@Yamaeda wrote:
Just reshape it to a 2D array and show that. Make it 6x20 and show 4 rows.
I would go one more step and use a table indicator. Now you can even do some custom formatting or at least guide the eye by various background tints.
That just wouldn't work for e.g. a P&ID.