Gateway scripting - previous value

What doesn’t work about it?

Keep in mind the first time the script executes there is no previous value, so it will be null / Python None, which you need to check for before you try to access its value component.