Logic Machine Forum
calculate groupadres - 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: calculate groupadres (/showthread.php?tid=4401)



calculate groupadres - Dré - 26.11.2022

Hi,

Is it possible to calculate a groupadres and use it to write a value?
Something like below?

I would write a value, depending on the month to a groupadres, but when it is november it has to write it to '56/1/151'
but when it is december i would write it to '56/1/161'


Code:
now = os.date('*t')
maand = now.month

calc = (maand -1) * 10
log(calc)
calc2 = 51 + calc
log(calc2)
new_groepsadres = '56/1/'..calc2
log(new_groepsadres)

grp.write('new_groepsadres', calc)



RE: calculate groupadres - Erwin van der Zwart - 27.11.2022

This should work but you convert your calculated value to a string on line 11 so change 'new_groepsadres' into new_groepsadres without the ''


RE: calculate groupadres - Dré - 27.11.2022

Wow thanks Erwin, that looks less difficult than i thought.
And yes it is working, thanks.