Your if-statement isn't searching over anything or assigning anything anywhere; it's just making a calculation in thin air. If you really only have two input choices and four servers for each, you could hardcode them into the search:
... | where ($token$="1" AND (host=a OR host=b OR host=c OR host=d)) OR ($token$="2" AND (host=e OR host=f OR host=g OR host=h))
Another alternative is to code the server list into your token value, if you don't actually need that value for anything else and it's just there as a placeholder:
<choice value="host=a OR host=b OR host=c OR host=d">1</choice>
<choice value="host=e OR host=f OR host=g OR host=h">2</choice>
Then you could use the token directly in your base search, which is more efficient:
index=foo $token$ ...
... View more