LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Block the calculation when user enters values in a table

Solved!
Go to solution

I have a table that can insert data into the first column, and a rule behind it calculates the value that should appear in the second column

But when the user edits the value of the second column, should keep the value of the user, you should not recalculate that row

How do I do that?

leandrofeder_0-1710848757620.png

 

0 Kudos
Message 1 of 8
(415 Views)

Hi leandro,

 


@leandrofeder wrote:

But when the user edits the value of the second column, should keep the value of the user, you should not recalculate that row


My opinion: a table/multicolumn listbox should mainly be used as indicator…

 

In the end you should keep your data in its own datastructure and only update the table based on that datastructure. For your example I would use a cluster per row to hold ["Carga", "CosPhi", bool(UserInput)]. That boolean value decides wether to use the current CosPhi value (given by user) or the recalculate CosPhi…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(404 Views)

It's a good way, but how do I differentiate between what the table calculated and what the user entered?
Since for each row typed, the table already calculates

0 Kudos
Message 3 of 8
(389 Views)

Hi leandro,

 


@leandrofeder wrote:

how do I differentiate between what the table calculated and what the user entered?


A table does not calculate, it only displays a 2D string array!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(382 Views)

Behind the scene, the table values are hopefully kept in a 2D array of strings in a shift register. You can easily use an event structure and check what parts has changed and keep an array of sentinel values (e.g. boolean) for rows that should not recalculate.

 

For more detailed help, we need to see your code so we can suggest the most suitable solution.

I would also strongly recommend to give clues to the users, e.g. change the background color of cells that are user corrected.

0 Kudos
Message 5 of 8
(329 Views)

I attached the VI, because so far I have not been able to make it work as expected

Its an good idea of change the background color of cells, thank you

0 Kudos
Message 6 of 8
(313 Views)
Solution
Accepted by topic author leandrofeder

@leandrofeder wrote:

I attached the VI, because so far I have not been able to make it work as expected



An easiest way is probably to replace the only empty strings, something like that:

Screenshot 2024-03-20 07.58.25.png

So, if something already enetered (doesn't matter by user or by calc), it will keep the value. If user will clear it, then it will be replaced with calculated value back.

The rest depends from your requirements. For example, if something changed in first column, then you would like to get calculated values again, then you have to track previous state in shift register, and if not matched - replace with new result.

Message 7 of 8
(242 Views)

Thank you Andrey

That's exactly what I was trying to do

0 Kudos
Message 8 of 8
(217 Views)