before you try the following … not sure why in the set variable there is square brackets enclosing the set variable statement.
first:
please remove those square brackets only and try. if that still does not work … then try the second one below:
second:
change that set variable line to the following and try please:
set variable Switch = mid(string($args.CurrentSwitch), 1, length(string($args.CurrentSwitch)) - 2)