# Logical expression CASE

**URL:** <https://forum.inductiveautomation.com/t/logical-expression-case/19484>\
**Category:** Ignition\
**Created:** [August 31, 2018, 6:30am UTC](https://forum.inductiveautomation.com/t/logical-expression-case/19484 "2018-08-31T06:30:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giuseppe.mollica](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Giuseppe.mollica](https://forum.inductiveautomation.com/u/Giuseppe.mollica)\
**Post date:** [August 31, 2018, 6:30am UTC](https://forum.inductiveautomation.com/t/logical-expression-case/19484/1 "2018-08-31T06:30:59Z")

</div>

good morning  
I have a question the logical expression CASE accepts numbers with a comma because I did some tests and with the whole numbers it works well but with the numbers es (1,1: 1,2 etc.) I can not make it work  
thank you

---

<div class="post-metadata">

**Author:** ![c.bertulli](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@c.bertulli](https://forum.inductiveautomation.com/u/c.bertulli)\
**Post date:** [August 31, 2018, 6:38am UTC](https://forum.inductiveautomation.com/t/logical-expression-case/19484/2 "2018-08-31T06:38:46Z")

</div>

Try to use the dot ( . ) instead of comma ( , ). Because the comma is seen as a “command separator”.  
So it will be 1.1 , 1.2 etc

---

<div class="post-metadata">

**Author:** ![Giuseppe.mollica](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Giuseppe.mollica](https://forum.inductiveautomation.com/u/Giuseppe.mollica)\
**Post date:** [August 31, 2018, 6:42am UTC](https://forum.inductiveautomation.com/t/logical-expression-case/19484/3 "2018-08-31T06:42:26Z")

</div>

> [@c.bertulli](#):
>
> Try to use the dot ( . ) instead of comma ( , ). Because the comma is seen as a "command separator". So it will be 1.1 , 1.2 etc

This is the expression of houses I wrote and written with the points because it does not accept it  
case({[.]prova\_liv\_slm} ,0, "100" ,1.1, "200" ,2.1, "300","FALSE")

---

<div class="post-metadata">

**Author:** ![c.bertulli](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@c.bertulli](https://forum.inductiveautomation.com/u/c.bertulli)\
**Post date:** [August 31, 2018, 7:05am UTC](https://forum.inductiveautomation.com/t/logical-expression-case/19484/4 "2018-08-31T07:05:16Z")

</div>

I tried to copy - paste your expression, and right as it is, it will generate an error saying “Cannot use relative tag paths in this context”.  
I changed the Tag Path (simply right click on the Tag and choose Copy Tag Path ) everything works as expected.

```auto
case(
{test/prova_liv_slm},//value
0, // case 1
"100", // return 1
1.1, // case 2
"200", // return 2
2.1, // case 3
"300", // return 3
"FALSE") // Default

```

---

<div class="post-metadata">

**Author:** ![c.bertulli](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@c.bertulli](https://forum.inductiveautomation.com/u/c.bertulli)\
**Post date:** [August 31, 2018, 7:15am UTC](https://forum.inductiveautomation.com/t/logical-expression-case/19484/5 "2018-08-31T07:15:34Z")

</div>

EDIT:  
Sorry, I miswrote the expression 😅  
You have also to specify the number type.

```auto
case(
{test/prova_liv_slm},//value
0, // case 1
"100", // return 1
toFloat(1.1), // case 2
"200", // return 2
toFloat(2.1), // case 3
"300", // return 3
"FALSE") // Default

```

---

<div class="post-metadata">

**Author:** ![Giuseppe.mollica](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Giuseppe.mollica](https://forum.inductiveautomation.com/u/Giuseppe.mollica)\
**Post date:** [August 31, 2018, 7:43am UTC](https://forum.inductiveautomation.com/t/logical-expression-case/19484/6 "2018-08-31T07:43:14Z")

</div>

thanks, it works great
