Error while cumulative tags creation. Error- Expression left operand is null

I want to increment value of one tag after every 1 minute with Boolean value condition of another tag, but I am getting below error.
Error_ExpressionEval(“Expression left operand is null.”)

I have written below expression into newly created expression tag and set execution rate Fixed mode- >
if(({[.]…/5 Mill Service PLC04_S7 Analyzer TCP/E 158_4 MCC2 Lubr_Unit Rough_Answer Line Pump 1 (KM)})=1 , ( (({[.]RunHrs }) +1 ) , ({[.]RunHrs}) )

if(Tag1 = 1, Tag2+1 , Tag2)

I just need to check if the Boolean tag value is 1 then increment the value of current tag by 1 else the the value would be same. I have written that tag expression on tag name RunHrs.

Boolean Tag -
{[.]…/5 Mill Service PLC04_S7 Analyzer TCP/E 158_4 MCC2 Lubr_Unit Rough_Answer Line Pump 1 (KM)}

New Expression Tag -
RunHrs

You can’t have a tag act on itself. Use a gateway timer script instead.

Example:

runningTag = '[default]test/isRunning'
hrsTag = '[default]test/RunTime'

isRunning, hours = [tag.value for tag in system.tag.readBlocking([runningTag, hrsTag])]

if isRunning:
	hours += 1
	system.tag.writeBlocking([hrsTag], hours)
1 Like

Thanks Jordan,

I have tried it from Gateway timer but it was not executing properly after every 1 min of interval. So I have created one Expression tag and from that tag I have called script with fixed rate of 1 min. runScript(“script path.MethodName”)
Its working fine now.