# Expression Case and Switch functionality change 7.9 to 8.1?

**URL:** <https://forum.inductiveautomation.com/t/expression-case-and-switch-functionality-change-7-9-to-8-1/83977>\
**Category:** Ignition\
**Created:** [January 9, 2024, 4:26pm UTC](https://forum.inductiveautomation.com/t/expression-case-and-switch-functionality-change-7-9-to-8-1/83977 "2024-01-09T16:26:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harold.bruulsema](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@harold.bruulsema](https://forum.inductiveautomation.com/u/harold.bruulsema)\
**Post date:** [January 9, 2024, 4:26pm UTC](https://forum.inductiveautomation.com/t/expression-case-and-switch-functionality-change-7-9-to-8-1/83977/1 "2024-01-09T16:26:47Z")

</div>

I have an expression tag that works in 7.9.17, but no longer works in 8.1.31. It is simple enough: Look for a matching String, return an Integer. (Just the opposite of what most people want to do....). In 7.9 it works, in 8.1 it always returns the default value 0.  
Originally I used a Switch expression:

```auto
switch({[.]Type},
{Z1/SILOS/RecipeNameList/Recipe01},
{Z1/SILOS/RecipeNameList/Recipe02},
{Z1/SILOS/RecipeNameList/Recipe03},
{Z1/SILOS/RecipeNameList/Recipe04},
{Z1/SILOS/RecipeNameList/Recipe05},
{Z1/SILOS/RecipeNameList/Recipe06},
{Z1/SILOS/RecipeNameList/Recipe07},
{Z1/SILOS/RecipeNameList/Recipe08},
{Z1/SILOS/RecipeNameList/Recipe09},
{Z1/SILOS/RecipeNameList/Recipe10},
{Z1/SILOS/RecipeNameList/Recipe11},
{Z1/SILOS/RecipeNameList/Recipe12},
{Z1/SILOS/RecipeNameList/Recipe13},
{Z1/SILOS/RecipeNameList/Recipe14},
{Z1/SILOS/RecipeNameList/Recipe15},
{Z1/SILOS/RecipeNameList/Recipe16},
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,0)

```

I also tried a Case expression, with same result:

```auto
case({FILLSYS/P1L13/Type},
{Z1/SILOS/RecipeNameList/Recipe01},1,
{Z1/SILOS/RecipeNameList/Recipe02},2,
{Z1/SILOS/RecipeNameList/Recipe03},3,
{Z1/SILOS/RecipeNameList/Recipe04},4,
{Z1/SILOS/RecipeNameList/Recipe05},5,
{Z1/SILOS/RecipeNameList/Recipe06},6,
{Z1/SILOS/RecipeNameList/Recipe07},7,
{Z1/SILOS/RecipeNameList/Recipe08},8,
{Z1/SILOS/RecipeNameList/Recipe09},9,
{Z1/SILOS/RecipeNameList/Recipe10},10,
{Z1/SILOS/RecipeNameList/Recipe11},11,
{Z1/SILOS/RecipeNameList/Recipe12},12,
{Z1/SILOS/RecipeNameList/Recipe13},13,
{Z1/SILOS/RecipeNameList/Recipe14},14,
{Z1/SILOS/RecipeNameList/Recipe15},15,
{Z1/SILOS/RecipeNameList/Recipe16},16,
0)

```

Did the functionality of these functions change, to no longer work with strings? Or any suggestions what I might be doing wrong? The Recipe names are simple 3-5 character strings.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 9, 2024, 4:55pm UTC](https://forum.inductiveautomation.com/t/expression-case-and-switch-functionality-change-7-9-to-8-1/83977/2 "2024-01-09T16:55:27Z")

</div>

Try including the tag provider in the tag path

---

<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:** [January 9, 2024, 5:03pm UTC](https://forum.inductiveautomation.com/t/expression-case-and-switch-functionality-change-7-9-to-8-1/83977/3 "2024-01-09T17:03:58Z")

</div>

Debug one step at a time. What does each of the simple expressions,  
`{FILLSYS/P1L13/Type}`  
`{[.]Type}`  
`{Z1/SILOS/RecipeNameList/Recipe01}`  
give you?

---

<div class="post-metadata">

**Author:** ![harold.bruulsema](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@harold.bruulsema](https://forum.inductiveautomation.com/u/harold.bruulsema)\
**Post date:** [January 9, 2024, 5:26pm UTC](https://forum.inductiveautomation.com/t/expression-case-and-switch-functionality-change-7-9-to-8-1/83977/4 "2024-01-09T17:26:43Z")

</div>

That's the answer, putting the tag provider in the tag path fixed it:

```auto
switch({[.]Type},
{[default]Z1/SILOS/RecipeNameList/Recipe01},
{[default]Z1/SILOS/RecipeNameList/Recipe02},
{[default]Z1/SILOS/RecipeNameList/Recipe03},
{[default]Z1/SILOS/RecipeNameList/Recipe04},
{[default]Z1/SILOS/RecipeNameList/Recipe05},
{[default]Z1/SILOS/RecipeNameList/Recipe06},
{[default]Z1/SILOS/RecipeNameList/Recipe07},
{[default]Z1/SILOS/RecipeNameList/Recipe08},
{[default]Z1/SILOS/RecipeNameList/Recipe09},
{[default]Z1/SILOS/RecipeNameList/Recipe10},
{[default]Z1/SILOS/RecipeNameList/Recipe11},
{[default]Z1/SILOS/RecipeNameList/Recipe12},
{[default]Z1/SILOS/RecipeNameList/Recipe13},
{[default]Z1/SILOS/RecipeNameList/Recipe14},
{[default]Z1/SILOS/RecipeNameList/Recipe15},
{[default]Z1/SILOS/RecipeNameList/Recipe16},
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,0)

```

Thanks!
