Alex K Posted September 1, 2005 Share 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. Link to comment Share on other sites More sharing options...
RalphL Posted September 1, 2005 Share Posted September 1, 2005 If (Left ( text , 1 ) >= "0" and Left ( text , 1 ) <= "9") If true then Number else Alpha Link to comment Share on other sites More sharing options...
Sanjai Posted September 1, 2005 Share Posted September 1, 2005 (edited) if(texttonum(left(text,1))>=0,"Numeric","alpha") Edited September 1, 2005 by Guest Link to comment Share on other sites More sharing options...
comment Posted September 1, 2005 Share 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 Link to comment Share on other sites More sharing options...
Raybaudi Posted September 1, 2005 Share 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 Link to comment Share on other sites More sharing options...
Alex K Posted September 3, 2005 Author Share Posted September 3, 2005 Thanx comment, that looks good, i'll give it a go. :beertime: Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 6669 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