Two ways:

1. Using decode and sign at same time, this two functions are existed in diferent versions.

2. If U are in latest version, probably U can use "case" function. Lookup the corresponding docus for the usage.

Take care