AM node script nodeState.putShared can't change the value set initially

I am using nodeState.putShared(“counter”, 1) in first scripted node and in second scripted node I get the value and increment it and put it back in nodeState.putShared(“counter”, 2).

However, I am expecting the last value set that is 2 when i do nodeState.get(“counter”) in any subsequent node but I get the initial value that is 1.

Tried to remove the variable from nodeState.remove(“counter”) but still does not help, it returns the first value set.

How to override/update the value set in nodeState.putShared() ?

1 Like

hi @vdl
As a workaround, you can replace nodeState.putShared(“counter”, 1) by sharedState.put(“counter”, 1).

1 Like