Have you checked the manual?
If you do you'll find that there indeed is a LOOKUP command and that it does exactly what you want.
Code:
LOOKUP cnt, [1, 4, 3, 6, 2, 7, 5, 0], PORTE
/Henrik