RobotStudio event

TEST instruction with string and numeric variables, should this work in the same way?

Hi there, my name is Alberto, I'm from Mexico, working at IPICYT (http://www.ipicyt.edu.mx/), I have been programming ABB robots like 2 years and all my knowledge I just got it on my own. One of the applications I did includes the necessity to use a "TEST CASE" instruction, but I realized that when I evaluate a numeric variable and a specific part of my code could be done when the variable takes a value from a wide range of numbers, eg:

TEST "numeric variable"
    
    CASE 1, 2 ,3, 4, 5, 6:
               "Do this part of the code when the variable takes any of the values above"

    CASE 21,34,67,89,78,56,34,98,56,9,11,10,27,98:
               "Do this part of the code when the variable takes any of the values above"
    DEFAULT

               "Something"

ENDTEST

In this case, "TEST" instruction has troubles because even though "numeric variable" takes, for example, a value of 21, it seems like "21" doesn't exist in the "row CASE", it is like "CASE" is overloaded (the same thing that happened with an "IF" instruction)and can not work with a large range of options. 

But you know what gets me? In order to solve the problems, I tried lots of methodologies and I end up changing this "numeric variable" to a "string variable". And it works, take next code for instance:

TEST total

            CASE "B3":

                !Dejar lingotes en: Mesa_4(0)

                DropL1:=FALSE;

                DropL2:=FALSE;

                a:

                MoveJ RelTool(mesa_4,0,0,0,\Rx:=0,\Ry:=0,\Rz:=0),v1000,fine,Efector_Final_Estibado\WObj:=wobj0;

                proceso31_Soltar_Pre_carga;

                IF colisión THEN

                    proceso23_Colisiones_MBuffer;

                    IF intentar=TRUE THEN

                        GOTO a;

                    ENDIF

                ENDIF

 

            CASE "X3","P2","A2","A3","D2","D3","I2","I3","P4","P3","T2","B4","F4","L4","H4","C4","O4","R2","Q2","S2","U3","V3","W3":

                !Dejar lingotes en: Mesa_1(250)

                IF total="X3" OR total="P2" OR total="A2" OR total="A3" OR total="D2" OR total="D3" OR total="I2" OR total="I3" OR total="P4" OR total="P3" OR total="T2" THEN

                    DropL1:=FALSE;

                    DropL2:=FALSE;

                    Grip:=FALSE;

                ELSEIF total="B4" THEN

                    DropL1:=TRUE;

                    Grip:=FALSE;

                    total:="A4";

                ELSEIF total="F4" THEN

                    DropL1:=TRUE;

                    Grip:=FALSE;

                    total:="D4";

                ELSEIF total="L4" THEN

                    DropL1:=TRUE;

                    Grip:=FALSE;

                    total:="I4";

                ELSEIF total="H4" THEN

                    DropL2:=TRUE;

                    Grip:=FALSE;

                    total:="D4";

                ELSEIF total="C4" THEN

                    DropL2:=TRUE;

                    Grip:=FALSE;

                    total:="A4";

                ELSEIF total="O4" THEN

                    DropL2:=TRUE;

                    Grip:=FALSE;

                    total:="I4";

                ELSEIF total="R2" THEN

                    Grip:=TRUE;

                    sujetar_lingote1:=TRUE;

                    total:="D4";

                ELSEIF total="Q2" THEN

                    Grip:=TRUE;

                    sujetar_lingote1:=TRUE;

                    total:="A4";

                ELSEIF total="S2" THEN

                    Grip:=TRUE;

                    sujetar_lingote1:=TRUE;

                    total:="I4";

                ELSEIF total="U3" THEN

                    Grip:=TRUE;

                    sujetar_lingote2:=TRUE;

                    total:="A4";

                ELSEIF total="V3" THEN

                    Grip:=TRUE;

                    sujetar_lingote2:=TRUE;

                    total:="D4";

                ELSEIF total="W3" THEN

                    Grip:=TRUE;

                    sujetar_lingote2:=TRUE;

                    total:="I4";

                ENDIF

ENDTEST

As you can see, there is a lot of options in one of the "CASES", but it works, I don't have problems using the TEST instruction with string variables. So, my question is; Why "TEST instruction" works well with string variables and why not with numeric variables (in this case of a wide range of options)? Maybe I'm just confusing concepts about the nature of these two kinds of variables and how they are evaluated, but I don't know. If someone has a source of information or something that helps me that would be great.

Thank you very much!

Best regards!

Answers