# Doubts about syntaxes

**URL:** <https://forum.inductiveautomation.com/t/doubts-about-syntaxes/32072>\
**Category:** Ignition\
**Created:** [February 9, 2020, 3:36pm UTC](https://forum.inductiveautomation.com/t/doubts-about-syntaxes/32072 "2020-02-09T15:36:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![felipe2010silva](https://avatars.discourse-cdn.com/v4/letter/f/54ee81/32.png) [@felipe2010silva](https://forum.inductiveautomation.com/u/felipe2010silva)\
**Post date:** [February 9, 2020, 3:36pm UTC](https://forum.inductiveautomation.com/t/doubts-about-syntaxes/32072/1 "2020-02-09T15:36:52Z")

</div>

Olá,

I some doubts about the syntax of some programming. There is an expression tag name **zCountShift** whose expression extracts the seconds from another time type tag and in the tag events scripts -\> Value changed tag **zCountShift** there is a schedule like this:

```auto
SecondValue = currentValue.value
Execute = 0
	if SecondValue == 58: Execute = 1 #hour count
	if SecondValue == 57: Execute = 2 #spoilage count inout
	if initialChange == 1: Execute = 0

```

I can’t understand this part of the schedule. If anyone can explain to me a little I will be very grateful

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [February 9, 2020, 5:19pm UTC](https://forum.inductiveautomation.com/t/doubts-about-syntaxes/32072/2 "2020-02-09T17:19:53Z")

</div>

```python
# Copy current value of tag zCountShift into SecondValue variable.
SecondValue = currentValue.value
# Initialize Execute variable with zero value so it will be zero unless changed by following lines.
Execute = 0
# The next lines should not be indented like the code you posted, unless there was code cut out between them and the line above.
# If SecondValue is 58, set Execute to 1.
if SecondValue == 58: Execute = 1 #hour count
# If SecondValue is 57, set Execute to 2.
if SecondValue == 57: Execute = 2 #spoilage count inout
# If this is the initialChange for tag zCountShift, set Execute to 0.
if initialChange == 1: Execute = 0

```

Note `=` sets the variable before it to the value after it while `==` compares the values before and after it for equality (results in True if they’re equal, and False if not).

This looks like code to choose different functions to execute at 57 (hour count) and 58 (spoilage count) seconds. It likely does nothing the rest of the time when Execute is zero. The last line prevents this from executing due to initial value change when tag comes online after saving changes, etc.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 9, 2020, 6:24pm UTC](https://forum.inductiveautomation.com/t/doubts-about-syntaxes/32072/3 "2020-02-09T18:24:13Z")

</div>

Expression tags must use only expression functions and the operators shown in the help sidebar. It is not jython. If you must, and you are careful not to block tag group execution, you can use the runScript() expression function to invoke jython.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [February 9, 2020, 7:07pm UTC](https://forum.inductiveautomation.com/t/doubts-about-syntaxes/32072/4 "2020-02-09T19:07:12Z")

</div>

True; if I read right, @felipe2010silva shared part of the tag event script from zCountShift which would use Jython as above, though the indentation posted was wrong.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 9, 2020, 7:09pm UTC](https://forum.inductiveautomation.com/t/doubts-about-syntaxes/32072/5 "2020-02-09T19:09:40Z")

</div>

> [@witman](#):
>
> shared part of the tag event script

Huh, missed that part of the OP. Carry on. /:

---

<div class="post-metadata">

**Author:** ![felipe2010silva](https://avatars.discourse-cdn.com/v4/letter/f/54ee81/32.png) [@felipe2010silva](https://forum.inductiveautomation.com/u/felipe2010silva)\
**Post date:** [February 11, 2020, 9:44am UTC](https://forum.inductiveautomation.com/t/doubts-about-syntaxes/32072/6 "2020-02-11T09:44:23Z")

</div>

@witman thank you for all help!!!

---

<div class="post-metadata">

**Author:** ![felipe2010silva](https://avatars.discourse-cdn.com/v4/letter/f/54ee81/32.png) [@felipe2010silva](https://forum.inductiveautomation.com/u/felipe2010silva)\
**Post date:** [February 11, 2020, 9:45am UTC](https://forum.inductiveautomation.com/t/doubts-about-syntaxes/32072/7 "2020-02-11T09:45:01Z")

</div>

@pturmel thank you for your help!!!
