Hi!!
I have a complicated request that I haven’t been able to solve in a simply way…
I need to have a Tag that is a Select from a Database, but if a user writes manually in that Tag I would like to Update the Database with the new value. I have tried to use a Tag Query with update but it doesn’t update nothing when I write into it.
Can anybody tell how can I do this without adding more Tags? (I need to do this with more than 100 Tags…)
Thanks everybody!!
You will have to have Ignition stop the Bidirectional strangely.
Using a SQL Query Tag, do the following:
- Create a numeric text field editor (or any other input really).
- Under Data, Value that points to the tag, uncheck Bidirectional.
- Under Event Handler, Select Property Change. SQL Update.
Set the update value to the same value as you are viewing.
The id can be mapped to a custom property, so you can get the key if needed (mine is id).
Cheers,
Chris
Hi, thanks a lot for the Reply!!
I will try it now!!
Do you have the SQL Bridge? The ease/effectiveness would depend on how your tables are structured, but you could set up your tags as Memory Tags, and then use a transaction group in “bi-directional” mode to map them to the database. Bi-directional mode in transaction groups syncs between the values in the db, and the values in tags- if one side changes (like when you write to the tag), it will be written to the db, and vice versa. It is traditionally used with OPC tags, but you could use memory tags.
The only issue that comes to mind with the method mentioned above is that the update query might run way too much, since I think that will be triggered any time any property changes on the component. Once you set it up like that, you might want to pop over to the “script editor” tab, and wrap all of the generated code in something like “if event.propertyName==‘intValue’:”
Regards,