The following gives the desired output for me when TELEPHONE 
is defined as char(10) in the database. Are you sure you're 
retrieving TELEPHONE as character data and not numeric? Are 
you able to output TELEPHONE without any formatting? Are you 
able to add 1 to TELEPHONE? If yes, you have a numeric value 
and would want to convert to string before formatting. HTH.

<cfquery name="getschools" datasource="mydsn" 
dbtype="ODBC">
select * from schools
</cfquery>

<cfquery name="getschoolinfo" datasource="mydsn" 
dbtype="ODBC">
select * from schoolinfo
</cfquery>

<html>
<head>
<title>Untitled</title>
</head>
<body>
<cfoutput query="getschools">
school=#schname#<br>
<cfloop query="getschoolinfo">
&nbsp; (#left(getschoolinfo.telephone,3)#) 
#mid(getschoolinfo.telephone,4,3)#-
#right(getschoolinfo.telephone,4)#<br>
</cfloop>
</cfoutput>
</body>
</html>

> Yes I am trying to format a phone number (it's kept in the database
> as 1234567890) for an output form. The problem is that the usual
> formatting (<CFSET TELEPHONE="(#left(SchoolInfo.TELEPHONE,3)#)
> #mid(SchoolInfo.TELEPHONE,4,3)#-#mid(SchoolInfo.TELEPHONE,7,4)#">)wo
> n't work for this output so I'm trying to move the formatting to
> inside the sql query. 
> 
> This formats fine: Gives the result: (123)456-7890
> <CFOUTPUT QUERY= "1">
> #TELEPHONE#
> </CFOUTPUT>
> 
> BUT I need it to loop through a 2ndary query and this does not work:
> Gives result 1234567890.0 <CFOUTPUT QUERY="1"> <CFLOOP
> QUERY="2ndary"> #TELEPHONE# </CFLOOP> </CFOUTPUT>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to