Alex K Posted September 1, 2005 Posted September 1, 2005 Hi Guys, I'd like to do a find on a field (defined as text) and depending on whether the 1st character is alpa or numeric, act accordingly. I'm ok on the logic and scripting side, I think I can extract the first character using the *Left ( text , number )* function - but how do I determine if it's alpha or numeric? I can't seem to find the correct function. Help appreciated.
RalphL Posted September 1, 2005 Posted September 1, 2005 If (Left ( text , 1 ) >= "0" and Left ( text , 1 ) <= "9") If true then Number else Alpha
Sanjai Posted September 1, 2005 Posted September 1, 2005 (edited) if(texttonum(left(text,1))>=0,"Numeric","alpha") Edited September 1, 2005 by Guest
comment Posted September 1, 2005 Posted September 1, 2005 (edited) That won't work, I am afraid. If text does not contain numeric characters, then [color:blue]TextToNum(text) = 0 is true. So your If() will always return true. Try instead: Case( IsEmpty( TextToNum( Left(text , 1 ) ) ) , "alpha" , "numeric" ) or: Case( Length( TextToNum( Left(text , 1 ) ) ) , "numeric" , "alpha" ) Edited September 1, 2005 by Guest
Raybaudi Posted September 1, 2005 Posted September 1, 2005 (edited) You can try this too: Case( GetAsNumber ( Left ( text; 1 ) ) = "";"alfha"; "numeric" ) Oops: I realised only now that You have FM6... the function GetAsNumber() is for 7 owners !! Edited September 1, 2005 by Guest wrong version
Alex K Posted September 3, 2005 Author Posted September 3, 2005 Thanx comment, that looks good, i'll give it a go. :beertime:
Recommended Posts
This topic is 7021 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now