Normal Topic [Solved] Formatting phone numbers (Read 423 times)
drastixnz
Full Member
***
Offline


A Newbie....

Posts: 146
Location: New Zealand
Joined: Nov 29th, 2006
[Solved] Formatting phone numbers
Oct 2nd, 2007 at 9:01pm
Print Post Print Post  
Cheesy Cheesy Cheesy Cheesy Cheesy Cheesy Cheesy Cheesy Cheesy Cheesy Cheesy  Roll Eyesteheheheh

Hi all i have this code and when I type a zero, which is part of a phone number it goes!! into the wild blue yonder i have tired changing the LE to a number format, but the whole thing buggers up so here is the code

// Formats Telephone Number - this version checks for proper amount of digits and 
// notifies user if there is a problem my element is named HomePhone

var vHPhone as String      
var vNewHPhone As String 
var vhphonecount 
var vhpnentered

     Vhpnentered = @num(Cellphone Number)
    
    
     vhphonecount = @num(@len(vhpnentered))

If vhphonecount > 0
    

If vhphonecount = "10" 


{
     // @color(Home Phone,1,1)
     vHPhone = @Num(Cellphone Number) 
     vNewHPhone = @Left(vHPhone, 3) + @Mid(vHPhone, 3, 3) + "-" + @Right(vHPhone, 4) 
     Cellphone Number = vNewHPhone 
}
else
{
     @color(Cellphone Number,7,1)
     @msgbox("The Cellphone Number needs to be Exactly 10 Digits", "The numbers you entered " + 
     @num(Cellphone Number),"is : " + Vhphonecount + " Digits Please check The Cellphone Number and Re-enter")
     
}



Help please
« Last Edit: Oct 3rd, 2007 at 8:44pm by Hammer »  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: "O where o where has my little zero gone!!!"
Reply #1 - Oct 3rd, 2007 at 12:56pm
Print Post Print Post  
To start

Code
Select All
@Mid(vHPhone, 3, 3) 



Needs to be

Code
Select All
@Mid(vHPhone, 4, 3) 



Also You will want to specify types for these two variables

Code
Select All
var vhphonecount
var vhpnentered  



So

Code
Select All
var vhphonecount  as Int
var vhpnentered as String 




Code
Select All
If vhphonecount = "10" 


Should be
Code
Select All
If vhphonecount = 10 





Other than that I need to know what number you are putting in and the result that you are getting.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
drastixnz
Full Member
***
Offline


A Newbie....

Posts: 146
Location: New Zealand
Joined: Nov 29th, 2006
Re: "O where o where has my little zero gone!!!"
Reply #2 - Oct 3rd, 2007 at 8:43pm
Print Post Print Post  
Thank you ray it now works!!!!
  
Back to top
IP Logged