Forum Discussion

DainiusA's avatar
DainiusA
Contributor
3 years ago

switch statement on assert element

Hello,

 

I am trying to make a switch statement on returned text for the first time. But I am doing something wrong. Can anyone guide me to the right path ?

 

function test ()
{
AssertSum = Aliases["Kernel"]["MainForm"]["CheckControl"]["zcheckTop"]["lblSum"]["Text"];
switch (AssertSum)
{
case AssertSum("56,22"):
SumButtonClick()
PaymentWindowClickCash()
PaymentWindowClickPay()
PaymentWindowClickFinalizePayment()
break;

case AssertSum("0,91"):
SumButtonClick()
PaymentWindowClickCash()
PaymentWindowClickPay()
PaymentWindowClickFinalizePayment()
break;

case AssertSum("40,63"):
SumButtonClick()
PaymentWindowClickCash()
PaymentWindowClickPay()
PaymentWindowClickFinalizePayment()
break;

default:
Log["Error"]("There is no sum like this")
break;
}
}

  • Hello ebarbera ,

     

    Thank you for your response, but I sorted this out just through if... else for now.

  • Hi DainiusA - 

     

    What is the error you are receiving? Or how is this not working in the expected way?

     

    Thanks, 
    Emma

    • DainiusA's avatar
      DainiusA
      Contributor

      Hello ebarbera ,

       

      Thank you for your response, but I sorted this out just through if... else for now.