on 06-01-2015 1:29 PM
Hello,
I have created a simple attribute view in which I want to check if the KUNNR field is NUMERIC or not and print the result accordingly. There is no IS_NUMERIC function available in string functions so please help to write it with help of IF or CASE statement.
Thanks,
SHriniwas
Hello Shriniwas,
I think you can use the ltrim function in combination with the chars function to check for that.
With ltrim you can remove the numbers and characters from the left side of the string.
With chars you count the still available characters after ltrim. If the counted number is greater than 0 it is alpha-numeric, if 0 it is numeric.
Example:
if(chars(ltrim("KUNNR",'0123456789')) > 0,'is alpha-numeric','is numeric')
-> for '120000' -> counter is 0 -> numeric
-> for '12000A' -> counter is 1 -> alpha-numeric
-> for 'A20000' -> counter is 6 -> alpha-numeric
Of course you can adapt the second argument of the ltrim and if function to your needs (e.g. add '+-.' for ltrim in case you check other fields with sign and decimal separator values).
Best Regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.