# Expression Function not returning Boolean

**URL:** <https://forum.inductiveautomation.com/t/expression-function-not-returning-boolean/92015>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 18, 2024, 1:39pm UTC](https://forum.inductiveautomation.com/t/expression-function-not-returning-boolean/92015 "2024-06-18T13:39:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Craig](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@Ryan\_Craig](https://forum.inductiveautomation.com/u/Ryan_Craig)\
**Post date:** [June 18, 2024, 1:39pm UTC](https://forum.inductiveautomation.com/t/expression-function-not-returning-boolean/92015/1 "2024-06-18T13:39:07Z")

</div>

I am using an expression function to try and flip a buttons enabled property on and off, based on tags. This is the current expression I have:

```python
if({this.custom.insReady} || {this.custom.prgrm} = 1,
	 'true',
 'false'
)

```

which returns a true or false correctly, but the true or false it returns makes the property not Boolean anymore and breaks the enabled property. Any ideas how I can fix this?

---

<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:** [June 18, 2024, 1:49pm UTC](https://forum.inductiveautomation.com/t/expression-function-not-returning-boolean/92015/2 "2024-06-18T13:49:19Z")

</div>

You're returning strings. You need to return boolean.

```python
if({this.custom.insReady} || {this.custom.prgrm} = 1,
    true,
    false
)

```

---

<div class="post-metadata">

**Author:** ![Ryan\_Craig](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@Ryan\_Craig](https://forum.inductiveautomation.com/u/Ryan_Craig)\
**Post date:** [June 18, 2024, 1:50pm UTC](https://forum.inductiveautomation.com/t/expression-function-not-returning-boolean/92015/3 "2024-06-18T13:50:15Z")

</div>

Welp, that was a silly overlook.... must need some stronger coffee. Thank you!

---

<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:** [June 18, 2024, 1:59pm UTC](https://forum.inductiveautomation.com/t/expression-function-not-returning-boolean/92015/4 "2024-06-18T13:59:19Z")

</div>

We've all done it.  
And here's another "obvious" simplification now that I think about it:

```python
{this.custom.insReady} || {this.custom.prgrm} = 1

```

This expression will return a true or false all on its own!  
My earlier attempt was effectively saying, "if the expression is true then return a true, otherwise false".
