Logic Machine Forum
Scripts for multiple group addresses? - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Scripts for multiple group addresses? (/showthread.php?tid=490)



Scripts for multiple group addresses? - RSV4 - 07.12.2016

Hi,

I will be periodically writing values of various group addresses to an external MySQL database and will have a common function (writedb) for database connection and writing. I now will have to provide an event script for every group address, something like

Code:
writedb('1/1/10', event.getvalue())

Is there an easier way to this instead of having tons of event scripts (one per group address) with just this one liner, where I manually have to adjust the group address in each and every script?

Thanks & best regards,
Robin


RE: Scripts for multiple group addresses? - admin - 07.12.2016

You can map scripts to tags. Also, you are missing () for getvalue in your example. This example might help as well: http://forum.logicmachine.net/showthread.php?tid=273&pid=1269#pid1269


RE: Scripts for multiple group addresses? - RSV4 - 07.12.2016

Perfect, that is exactly what I need. Thanks!

Edit: fixed the missing ()