Return hour value to memory tag called hour with this tag

missing syntax
date =

I'm not sure what the question is, are you wondering why your script doesn't work in a tag expression?? If so, this doesn't work because you are using Ignition's scripting language in an expression. Expressions use the expression language not scripting.

// 10,000ms = how often to evaluate now(), blank = use tag scan rate, 0 = off

The expression language is not a scripting language. It does not support the '=' assignment instruction but does accept '=' as a comparison operator.

x = 5 is an assignment and will fail.
if({value} = 5, "Five", "Not five") is a comparison operation and will work.

Think of expressions as being like Excel formulas. They perform operations on values but are not scripts.

It does work - getHour24(now()) returns the integer for the hour. Do you know how I can get date and time? getDateTime() does not seem to work

When you are writing your expression, click on the sigma symbol in the editor to see all expression functions. Also, see the link I reference in my first post. now() by itself would return a date time.

thanks very much

1 Like