Datatype transforming in Vision

I’m fairly new to Vision 11.1.10 and Perspection 2.1.10 in Ignition 8.1.10 and am new to Python and JSON. I’ve been developing projects to be used in my facility for these past few months. I’ve found using the Transform Mapping function in Perspective to be very helpful, unfortunately, I cannot somehow find a way to do something similar in Vision. I need to be able to convert various datatypes to another whether in the Component Scripting, Property Binding or etc… A few examples can be transforming “Integer” to “Boolean”, “Integer to String”, vice versa, and many different variations. Any help with resources, examples, and anything else that can help will be greatly appreciated. Thank you

There’s a whole category of type casting functions in the expression language, these would work in your bindings, no?

https://docs.inductiveautomation.com/display/DOC81/Type+Casting

Jython/Python has its own functions for casting data: int(), float(), str().

If this doesn’t get you where you need then you’ll probably need to provide a more concrete example of something you’re struggling with.

Is there a way to map or “transform” similar to Perspective? Such as:
Input Boolean: ‘false’ or ‘true’ > Output String: “Off” or “On”
Input Integer: ‘0’ and ‘1’ > Output String: “Stopped” or “Running”

As well for vice versa, please.

Thank you

It depends what component, style customizer on some components will do that. If that doesn’t work, try property change event and scripting.

1 Like