Expression Case and Switch functionality change 7.9 to 8.1?

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:

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:

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.

Try including the tag provider in the tag path

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

1 Like

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

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!

1 Like