Hello, we have an issue related to HMI dynamics.
We are trying to restrict input values in a textinput box: if the new value is within a specific range, a PLC variable must be updated. Otherwise, the value should be rejected.
A minimal example consists of four INT global variables:
myvar: the PLC variable
myvar_min: minimum value
myvar_max: maximum value
myvar_aux: auxiliary HMI textbox variable.
We have the HMI page with a textinput box and three dynamics:
-
Text:
assign the user value to myvar_aux -
Action on data (1): Write value
Expression: NOT( myvar_aux >= myvar_min AND myvar_aux <= myvar_max)
Source type: variable
Source variable: myvar
Destination: myvar_aux -
Action on data (2): Write value
Expression: ( myvar_aux >= myvar_min AND myvar_aux <= myvar_max)
Source type: variable
Source variable: var_aux
Destination: myvar
When the input value is out of range, dynamics 2) will reject the value by replacing the user value with the actual one. Otherwise, dynamics 3) will update the PLC variable.
The problem is that this solution only works on the first attempt. For example:
Assume that:
myvar_min = 10
myvar_max = 120
The user types the value 35 and gets
myvar_aux = 35
myvar = 35
Now, the user types another valid value, 70, and gets
myvar_aux = 70
myvar = 35
which is incorrect because the PLC variable was not updated. However, if the page is reloaded with F5, the correct value is saved on myvar.
This behavior was observed in simulation mode with 1152 controller (PLCNext Eng. 2023.0.4 and 2024.0.2 LTS). Also, in a F2152 controller with firmware 2024.0.
In this post, an issue related to cache handling was mentioned. In our particular case, it is not desirable to disable the cache and we have not seen any positive results from doing so.
Any suggestions for resolving the issue would be greatly appreciated.
Thank you
Sebastian