Script question

Hi,
I have a LED display and I would like to add a increment by 1 button.
I succed by doing it 2 way and I would like to know which one is the most efficent.
My button as a dynamic parameter called Increment.

Script #1.

val = system.tag.getTagValue(“MyTagName”);
val = val - event.source.Increment;
system.tag.writeToTag(“MyTagName”,val);

Script #2.

event.source.parent.getComponent(‘LED Display’).value = event.source.parent.getComponent(‘LED Display’).value + event.source.Increment

Thanks

Both are fine. I prefer the first one since you get the tag value and increment by one in the script. The second one will only work if the led’s value is bound bi-directionally to the tag (that is if you want the tag to update).