# Expression Structure in Vision

**URL:** <https://forum.inductiveautomation.com/t/expression-structure-in-vision/91211>\
**Category:** Ignition\
**Tags:** vision, perspective\
**Created:** [May 31, 2024, 6:07pm UTC](https://forum.inductiveautomation.com/t/expression-structure-in-vision/91211 "2024-05-31T18:07:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_Moody](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@Sean\_Moody](https://forum.inductiveautomation.com/u/Sean_Moody)\
**Post date:** [May 31, 2024, 6:07pm UTC](https://forum.inductiveautomation.com/t/expression-structure-in-vision/91211/1 "2024-05-31T18:07:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 31, 2024, 6:12pm UTC](https://forum.inductiveautomation.com/t/expression-structure-in-vision/91211/2 "2024-05-31T18:12:32Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 31, 2024, 6:13pm UTC](https://forum.inductiveautomation.com/t/expression-structure-in-vision/91211/3 "2024-05-31T18:13:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Sean\_Moody](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@Sean\_Moody](https://forum.inductiveautomation.com/u/Sean_Moody)\
**Post date:** [May 31, 2024, 7:27pm UTC](https://forum.inductiveautomation.com/t/expression-structure-in-vision/91211/4 "2024-05-31T19:27:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sean\_Moody](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@Sean\_Moody](https://forum.inductiveautomation.com/u/Sean_Moody)\
**Post date:** [May 31, 2024, 7:27pm UTC](https://forum.inductiveautomation.com/t/expression-structure-in-vision/91211/5 "2024-05-31T19:27:41Z")

</div>

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
