I have an attribute that has a value of say for example (-5). If I set the attribute to -4 its actually incrementing it making the attribute now -9 instead of the -4 I set it to… is there a way to prevent this? Thanks.
Negative integer attribute - how to update without incrementing (replace)
Hi there,
Unfortunately this is due to the fact that attributes allow you to use the +n or -n notation for adding or subtracting to/from the existing value. The only way to really get around this would be to either put a space between the - and the number or perhaps store the value as simply the number and then use the Text service to insert the - at the time of using it.
We do have an idea on the roadmap to have a method of overriding the -n value when updating an attribute. Please do pop over and vote on this.
Hi, thanks for letting us know.
However, none of those workarounds are that good for us… First, if we are storing something like a timezone which could be positive or negative you can’t just add the symbol after the fact using the text service (you can’t know whether its a positive or negative tz number beforehand). And the other approach using a space would require you to write custom code to trim the space for every field where you use negative numbers… that one is more doable, however, very cumbersome.
IMHO a setter should never behave as an operating function. if one sets an attribute the assumption is the attribute its replaced/updated… I don’t understand how an arithmetic functionality on an attribute could take precedence over the basic logical functionality of a ‘set attribute’…perhaps you guys should define those kinds of attributes as counters or some custom type? I voted for the issue in trello.
Is there a way to access the “Attributes” from the “execute code” step? not just one specific attribute, but all of them for the user?
Thanks!
its actually very easy to pass the attributes object… just pass the whle thing as input … thank you!