How force value of property to be accept as string for integer value

Hello
I want to put some string into the params property of a view. the problem is because property doesn’t have type, if the value is a number the value interpret as number, but I want in some cases it read as string it doesn’t work. putting “” around value add those “” into string itself.
For example put 123 -> 123 number
‘123’ - > ‘123’ string not 123 string
I want this: 123 -> 123 string

You could use a property change script:

if (previousValue is None) or (currentValue.value != previousValue.value):
	self.custom.key = str(currentValue.value)

Two things before you do this:

  1. the value comparison is important to prevent infinite loops because previousValue and currentValue will always have different timestamps and so will never be equal, whereas their values could be.
  2. the check against previousValue being None is important because the first time the change event occurs there is no “previous value”.
3 Likes