# IF Statement Question

**URL:** <https://forum.inductiveautomation.com/t/if-statement-question/105173>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [April 16, 2025, 1:59pm UTC](https://forum.inductiveautomation.com/t/if-statement-question/105173 "2025-04-16T13:59:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahawes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahawes/32/36337_2.png) [@ahawes](https://forum.inductiveautomation.com/u/ahawes)\
**Post date:** [April 16, 2025, 1:59pm UTC](https://forum.inductiveautomation.com/t/if-statement-question/105173/1 "2025-04-16T13:59:24Z")

</div>

Good morning Team,

I have number of pallet conveyors at the facility. I am building a button to allow the user to change the destination of a pallet uing a db update query.

I only want this button to be visible when a pallet is located on a specific set of conveyors.

This expression below works.

```python
if(({../Pallet Info.props.data}[0, 'location']) = 'PT20050', true, false)

```

My issue is that i want it to look at a selection of conveyors.

Something like this:

```python
if(
  {../Pallet Info.props.data}[0, "location"] = "PT20060" or
  {../Pallet Info.props.data}[0, "location"] = "PT20450" or
  {../Pallet Info.props.data}[0, "location"] = "PT20440" or
  {../Pallet Info.props.data}[0, "location"] = "PT20430" or
  {../Pallet Info.props.data}[0, "location"] = "PT20420" or
  {../Pallet Info.props.data}[0, "location"] = "PT20410",
true,
false)

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/b/abc5d0f3d24085117e35f9af3d52118685fa65e1.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/6/e6a640efd3a052bc632e1635142fe674b6e0b72d.png)

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [April 16, 2025, 2:11pm UTC](https://forum.inductiveautomation.com/t/if-statement-question/105173/2 "2025-04-16T14:11:23Z")

</div>

Use `||`, not `or` in expressions. You also don't need the `if`:

```python
{../Pallet Info.props.data}[0, "location"] = "PT20060" ||
{../Pallet Info.props.data}[0, "location"] = "PT20450" ||
{../Pallet Info.props.data}[0, "location"] = "PT20440" ||
{../Pallet Info.props.data}[0, "location"] = "PT20430" ||
{../Pallet Info.props.data}[0, "location"] = "PT20420" ||
{../Pallet Info.props.data}[0, "location"] = "PT20410"

```

---

<div class="post-metadata">

**Author:** ![ahawes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ahawes/32/36337_2.png) [@ahawes](https://forum.inductiveautomation.com/u/ahawes)\
**Post date:** [April 16, 2025, 2:15pm UTC](https://forum.inductiveautomation.com/t/if-statement-question/105173/3 "2025-04-16T14:15:50Z")

</div>

> [@Ryan\_Deardorff](#):
>
> ```python
> {../Pallet Info.props.data}[0, "location"] = "PT20060" ||
> {../Pallet Info.props.data}[0, "location"] = "PT20450" ||
> {../Pallet Info.props.data}[0, "location"] = "PT20440" ||
> {../Pallet Info.props.data}[0, "location"] = "PT20430" ||
> {../Pallet Info.props.data}[0, "location"] = "PT20420" ||
> {../Pallet Info.props.data}[0, "location"] = "PT20410"
> 
> ```

Ryan,

Thank you for the help. How would I know to do that? Is that a json thing vs. an SQL query thing?

I do see it in the logical operations, i just did not think to use that.

---

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [April 16, 2025, 2:17pm UTC](https://forum.inductiveautomation.com/t/if-statement-question/105173/4 "2025-04-16T14:17:25Z")

</div>

It's an [Ignition expression language](https://docs.inductiveautomation.com/docs/8.1/platform/expression-language-and-syntax#operators) thing, roughly reminiscent of Java but not quite.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 16, 2025, 2:23pm UTC](https://forum.inductiveautomation.com/t/if-statement-question/105173/5 "2025-04-16T14:23:33Z")

</div>

There's no json or sql involved here. It's only an expression, which is an ignition thing. See the link posted by Felipe above.  
Do not confuse it with python (actually, jython), which is used for scripting.  
You'd use `or` in python, and `||` in expressions.  
Which you should be careful not to confuse with `|`, which has the same meaning in both python and expressions.

`or` and `||` are a logical or, used to check if at least one of 2 operands is true.  
`|` is a binary or, used to do a bit wise processing of 2 operands (b1010 | b1001 results in b1011)
