CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Dropping Leading Zeros: Interger: Format Property

Print topic Send  topic

Author Message
poing

Posts: 1
Posted: 04/14/2009, 6:46 PM

I am having issues getting CCS to properly format a 10 digit number without dropping the leading zeros. I am using: CCS 4.2.00.040/mySQL/PHP

The mySQL table is configured to return the leading zero using 'zerofill', but it looks like CCS is stripping it away whenever the value is treated as an integer.

mySQL: number INT(10) ZEROFILL NOT NULL COMMENT 'Phone Number'
CCS Format: ##-####-####

If I change the 'Data Type' to text, it will display the leading zero. But then I can't use CCS format property.

My best guess is, its how the PHP is handling the integer. So I may be stuck with something complicated like SELECT CONCAT(LEFT(number,2), '-', MID(number,3,4), '-', RIGHT(number,4)) every time I need to format a phone number.

Of course I could also create a function to do most of the work for me, but I am trying to avoid creating custom queries every time I want to format a phone number field.

While there are plenty of workarounds, does anyone have a suggestion on how to get CCS to handle the formatting with the leading zero?


Thanks,
Brian LaVallee







View profile  Send private message
datadoit
Posted: 04/15/2009, 6:59 AM

http://us2.php.net/sprintf

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.