03-19-2024 06:44 AM - edited 03-19-2024 06:46 AM
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?
Solved! Go to Solution.
03-19-2024 07:06 AM
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…
03-19-2024 07:18 AM
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
03-19-2024 07:24 AM
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!
03-19-2024 11:37 AM - edited 03-19-2024 11:40 AM
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.
03-19-2024 11:47 AM - edited 03-19-2024 11:49 AM
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
03-20-2024 02:04 AM
@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:
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.
03-20-2024 06:27 AM
Thank you Andrey
That's exactly what I was trying to do