Ritik
(Ritik Dodhiwala)
1
I tried using normal switch with Operators as case Like this
Var3 get populated from excel either +,-,*,/
while debugging I have noticed switch case is not working
Expression Var3
Case “+”
Varint4 = Varint1 + Varint 2
Case “-”
Varint4 = Varint1 - Varint 2
Case “*”
Varint4 = Varint1 * Varint 2
Case ""
Varint4 = Varint1 \ Varint 2
Sreelatha278
(Sree Latha Reddy)
2
@Ritik Change the type argument as String in Switch case activity.
1 Like
@Ritik Remove the “” from “+” if having argument as string. Apply it on all cases.
Divyashreem
(Divyashree Muddagangaiah)
4
Your switch case should looks like this
Ritik
(Ritik Dodhiwala)
5
Hi @Divyashreem, @Emman_Pelayo,
Thanks for reply.
I tried putting Cases like shown in screenshot by Divya, However Switch is not recognizing any of the operators.
Regards,
Ritik
@Ritik Add a default case, then writeline your argument so you can compare.
Divyashreem
(Divyashree Muddagangaiah)
7
Before passing those to cases you should convert that as string then pass them in condition.
Ritik
(Ritik Dodhiwala)
8
Hi @Emman_Pelayo,
Thanks for quick reply.
I got the issue, actually in Excel from where was reading data all operators were stored leading with Space .
For Example
" +" ," -“,” *“,” /"
Hence I used trim and it worked
Var3 = Trim (row(0).Tostring)
Expression Var3
Case +
Varint4 = Varint1 + Varint 2
Case -
Varint4 = Varint1 - Varint 2
Case *
Varint4 = Varint1 * Varint 2
Case
Varint4 = Varint1 \ Varint 2
Thanks all for reply.
Regards,
Ritik
2 Likes