I've got a field that contains employee Id numbers that I'd like to be able to by, the problem is that temporary employees are given id numbers with a v at the beginning. So id numbers would show as:
232
3567
68901
V4156
V24567
To be able to sort this accurately I'm trying to create an expression that checks if it has the v and if so only takes the numbers from the other side and adds 100000 since no id is in that range and I could still accurately sort with that field.
I've tried:
Iif(left([emplid]),1="V",(iif(len([emplid])=6, right([emplid],5)+100000),right([emplid],4)+100000),abs([emplid]))
Which instead of getting 104156 and 124567
In place of v4156 and v24567 I just get 100000 for both.
I've also tried testing:
Iif(len([emplid])=6,right([emplid],5)+100000), right([emplid],4)+100000)
Which results with replacing the v like i want but also effects the numbers without the v.
Edit:
So right after I posted I tried adding parenthesis at (left([emplid],1))="V" to the top expression and it worked but it still sorts by first number so sort looks like:
1
10
10000
2
2000
When I need:
1
2
10
2000
10000
I've tried using abs() around the whole expression but it doesn't seem to affect it.