08-26-2019 10:15 PM
I have an array of indicators that are created dynamically along with a set of channel properties (array). I would like to map array elements to the captions of the dynamically created indicators. I created a caption text property from one of the indicators and am trying to loop thru and write the proper caption. What I'm seeing is that all the captions get written the same value as it indexes thru the 'for' loop. How do I index into the correct indicator? Thank you!
Solved! Go to Solution.
08-26-2019 11:28 PM
Based on your Logic the Last Value will be the one which will get reflect. and For array you cannot provide unique Label for each element.
All the Elements in the array will be having same Label.
08-27-2019 01:04 AM
Hi beneeto,
in an array all elements share the same properties. They only differ by their value.
The caption of the numeric element is a property…
Possible solutions:
08-27-2019 02:11 PM
Thanks the text box worked well. One followup on this though. The channel name and units columns are flickering every 100ms (see attached vid). What's the proper way to handle this?
08-27-2019 03:03 PM
08-27-2019 04:35 PM
What Gerd says is correct.
But there is also a graphical bug with tables that causes that flickering. You can get rid of the flicker if you take a small transparent decoration and place it so it overlaps the table, even if just barely.
08-27-2019 06:13 PM
I've dropped the scan time to 200ms and added the transparency decoration. Thank you, those are both good improvements. I'm not sure I want to dive into adding an Event structure to handle value change (assuming that's what you're suggesting)..although I know that's the correct way to do the display.
I have a follow-on question about handling multiple tables. I apologize if I should be starting a new thread, but figure I already had your attention. I added a case statement that splits the displayed channels into two tables. As shown below i'm using the 'last value' of the for loop as an input to the case selector. That obviously doesn't work. I've been fooling around trying to refactor things and thought i would ask for suggestions. Thanks again.
08-27-2019 09:33 PM
What is the purpose of the two tables? What determines what goes into table 1 vs. table 2?
08-28-2019 03:34 AM
@beneeto wrote:
I added a case statement that splits the displayed channels into two tables. As shown below i'm using the 'last value' of the for loop as an input to the case selector. That obviously doesn't work. I've been fooling around trying to refactor things and thought i would ask for suggestions. Thanks again.
Now you need to pause and think things through. As you're sending 'i' to the case selector you're using "How many lines did i recieve, minus one, unless it's zero in case it's still zero". That's not a very secure way of handling the data.
It's better to use Array Size on the incoming array (and even better to switch the notifier to a queue, that's basically all you need to do).
But, i'm assuming your logic is (correct me if i'm wrong):
- If i get 24 channels, update table 1
- elsif i get 0 channels then i'll update the table with an empty array (this should be safe, if unnecessary and is one of the causes of the flicker)
- else update table 2
What i'd do is add a row 1st in the array that indexes which table the data should go to. You just need to add a Split array and let this 1st number control the Case and the other continues on like now.
/Y
08-28-2019 11:21 AM
Thanks, that is an easy solution to implement.