Page 1 of 1

AlNum Function Giving Me Headaches

Posted: Wed Aug 26, 2015 1:11 pm
by Tampa_Indy
I am trying to run the following:

if alNum(left(trim(<string>),1)=1 and length(trim(<string>)) > 1 then SetNull() Else <string>[2,10]

However, it is not working?! Any idea what I am doing incorrectly? I removed everything except AlNum(<string>)=1 then setnull() else <string>[2,10] but that does not appear to work either??

Posted: Wed Aug 26, 2015 1:57 pm
by chulett
Why don't we start by you spelling out in words what it is you are trying to accomplish, your requirements here.

Posted: Wed Aug 26, 2015 2:24 pm
by Tampa_Indy
I am trying to distinguish non-numeric values with alphanumeric ones. For example, if you have the following values:

#
^345
* 999
STRK
STLM
Close*tome

I would want to completely remove '#', have a field contain '345' and ' 999' and a different field with 'STRK' 'STLM' and 'Close*tome'

Posted: Wed Aug 26, 2015 3:12 pm
by chulett
So... if the first character is alphanumeric then do something else do something else? And not at all clear on what you mean by "a different field".

What about your expression "is not working"? To me it looks like you want to set the result to NULL if the first character is alphanumeric and there is more than one character in the string, otherwise the result is everything minus the first character.

Posted: Thu Aug 27, 2015 1:07 am
by priyadarshikunal
as per the expression you posted if the first character of the string is alpha numeric and the string is more than one character long then setnull() else take last 9 characters. which doesn't sound same as the example you provided. Can you be more clear on requirement?