You are not logged in.
Pages: 1
Topic closed
i want to read a value from a database into a input field on the HMI that works but de value that i read i want to change in the input field en write te nieuw value into the database hoe doe i do that ?
Offline
Maybe you could use an input field and use a separate 'SET'-button to write this value to your database by using an additional auxiliary signals __Trigger (page 10 of DbDrv_ENG.pdf).
Offline
I have no idea how to use this __Trigger but I guess it is something like this :
I can not test it myself at the moment so....
Offline
Hey martijnperdaan,
I think that this can be done only with some additional priorities. You would like to read a value from DB to Rex - that is possible. But you would also like to change the value according to HMI input and write it to the DB. These two requirements goes against each other.
You will probably have to add some additional logic which will determine if the value should be overwritten in DB or in HMI input.
Can you describe your application more into the deep so we can think of some other possible solution?
Regards, Tomas
Offline
On the HMI there is a input fields that show de streeftemp (target temp) of the room but i somtimes want to change te target temp in the input field
Offline
Is there any reason for reading the target temperature from DB? (i.e. temperature is changing in DB from some other source, application, program, etc.?) Or do you want just to store the trend of target temperature values to DB?
Cheers, Tomas
Offline
i want to store it in a database because if there is some kind of blackout it starts up again read the database and it works again otherwise
i have to put the value in the input field again
ps sorry for my bad english
Offline
anyone ?
Offline
I see your point - you want to use it as some kind of persistent memory, right?
This can be done using database, but you need to be careful about handling with read / write commands from / to database as I already mentioned. Following picture shows how it can be done in REX. It uses triggered writing to database on signal change (change from HMI input) by auxiliary flag. You will need to reconfigure your HMI according to the picture - read target temperature from DB flag and write it to constant CNR_StreefTemp.
You also need to change your .rio configuration file to read and write to the same item in certain database table.
There is one drawback I'm able to think of now - the value in HMI will remain for a while unchanged after you edit it manually because it takes some time to process the value to and from database. This can be a bit confusing.
Please, take it as a hint. It's not a working solution since I don't have any hardware available to test it on by now
There are more options to satisfy your requirements - please see SILO Reading value from file example or REXLANG Reading value from file example.
Hope it will be useful for you.
Regards, Tomas
Offline
Is it maybe possible to execute a php schript from a rex function Blok ?
Offline
It is possible to call external scripts or commands - for more details see EPC Email notification example.
Note that in order to use EPC function block you need to have Advanced blocks installed on your target device and licenced.
Cheers, Tomas
Offline
I prepared a solution of this problem without the delay of value change in your HMI. Please, download the sample project.
In order to make it work you need to change HMI connection strings of the temperature to both read and write from / to "CNR_StreefTemp". If you will change the value manually (in HMI or directly in "CNR_StreefTemp") the value will be written to the database as well. If the database writing fails for some reason it will change the value of "CNR_StreefTemp" back to that one stored in the database. This means that after blackout is should automatically read the value from database and set it to "CNR_StreefTemp" as well.
Feel free to contact me if you will have any questions regarding this solution.
Cheers, Tomas
Offline
Pages: 1
Topic closed