LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

find cell that triggered event value change on table

Solved!
Go to solution

Hello,

 

I have a table, it's basically a 2D-array of strings.... I have an event case, it's set up to trigger if there's a value change on my table.  Does anyone know how I can find out what cell triggered my event case? Which element in the table had the value change?

 

My table is large and has some repeating strings, I'm trying to find the row and column indicies to the corresponding cell that had the value change.

 

thank you.

0 Kudos
Message 1 of 9
(4,987 Views)

There is probably a better way to do this, but this is a brute force method:

 

20667i78F92A56CAEB3C38

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 9
(4,977 Views)
Solution
Accepted by topic author Monse

Yep, there is a better way:

 

20669i35AA3D1CD7AC969B

- tbob

Inventor of the WORM Global
Message 3 of 9
(4,975 Views)

awesome, thank you! I'm glad you found that 2nd approach Smiley Happy

0 Kudos
Message 4 of 9
(4,963 Views)

I know this is an old thread, but I found an issue with this approach.  

 

If you change a value and instead of selecting enter you click somewhere else on the table then you now have a value change event and your selection has changed, giving you the incorrect selection start. 



-Matt
Message 5 of 9
(3,597 Views)

I also excuse myself for digging up an old thread, but I do have the same issue.

Does there exist a method to prevent that behavior. 

I tried using a multicolumn listbox, but that just complicated things.

Is there a way, to first process the value change event and later the klick an change selection event?

 

Thanks in advance

 

Manfred 

0 Kudos
Message 6 of 9
(2,575 Views)

Rather than using the selection start property I would suggest using the EditPos property, as this tells you which cell you're actually editing.

 

This still has the same issue of showing you which cell you're currently editing, so I would suggest having a timeout case in the loop and reading the property in the timeout case (let's say every 100 ms). That way, when you get the value change event, you can use the EditPos value you got during the last timeout, which is probably the actual edited cell, as it's unlikely the user had time to give the cell focus and edit it in under 100 ms.

 

This is still somewhat flaky, so I would still consider using tbob's method, which could also be made cleaner by being made into a subVI and using a conditional stop.


___________________
Try to take over the world!
Message 7 of 9
(2,555 Views)

Thank you tst,

that sounds like a very interesting idea. 

 

I´m not a big friend of tbobs solution though, because the table might get bigger over time which might add 

to the execution time. Even with the conditional stop. 

 

At the moment I´m trying to "solve" my problem with a multicolumn listbox but I´m not very happy with some 

inherent changes of the operation. For example, the inability to edit the values in the cells directly.

But I have built two VIs doing exactly the same. One with a multicolumn listbox and the second with a table. 

I´ll try to implement your sugguestions and see which one works better.

 

Thank you very much

 

Regard

Manfred  

0 Kudos
Message 8 of 9
(2,533 Views)

If you want to have both safety and performance, you can use a combination of the two ideas: Use the timeout case to monitor the EditPos and whenever it changes add it to a circular buffer with a few elements (for example a queue with a lossy enqueue or an array which you modify using Rotate 1D Array) and when you get a value change, check just the positions in the circular buffer to see which of them changed. Ideally, it will always be the last one, but just in case, this lets you have access to the last few cells you edited.


___________________
Try to take over the world!
0 Kudos
Message 9 of 9
(2,518 Views)