Expression Structure in Vision

Hello all, I am rather new to using vision as I have mainly used perspective up to this point. However, I am working on vision now and I have ran into an issue.

I have a display whose data is determined by taking two integers, converting them to 8 bit binary numbers, combining the binary numbers to create a 16 bit binary number, then converting that 16 bit binary number to a double value. It is the finale double value which is displayed.

I have done this in perspective by binding the value to an expression structure and then transforming the data using the following script:

num1 = value["key"]
num2 = value["key_1"]
binary1 = format((num1 & 0xFF), '08b')
binary2 = format((num2 & 0xFF), '08b')
Combined = binary2 + binary1
mBar = int(Combined, 2)
PSI = mBar/68.948
return PSI

Where key is the first tag and key_1 is the second tag.

This works as expected and the correct value is displayed. However, I need to display this exact value in a vision project now. But when I went to go through the same process on the display in vision, I noticed that vision does not have an expression structure option for binding and only an expression option.

Given this, what would be the best course of action to take. I am not sure how I can fit my script all down into the single expression that is required using just the expression option. Is there a way to get in vision a similar binding to the expression structure and transform option that is in perspective?

Thank you in advanced to any help.

Vision has neither transforms nor structure bindings. Typically, since a script is involved, one would use runScript() in an expression binding to call a project library script function, passing your arguments to it. (Also typically with a zero poll rate, so it runs only when the arguments change.)

Where are the two integers coming from? Are they tag values?
If they are then just create an expression tag,
({[.]numHiByte} * 256 + {[.]numLoByte}) / 68.948)

This should do the job if you are sure that the two bytes won't go negative.

That makes sense thank you I will do my scripting this way.

Yes they are tags but it can be a negative value so I am going to do as @pturmel said and use the project library script