I'm curious if anyone knows an easy way to spell out the number of records returned from a query. What I'm using works, but it seems like there should be an easier way. Here's what I'm doing:
Then I output the number in the middle of a paragraph of text describing how many there are.
Thanks,
PT
putting the "new" in "newb".....
Code:
<cfquery name="qryMyQuery" datasource="MyDataSource">
SELECT *
FROM tblMyTable
ORDER BY MyID
</cfquery>
<cfoutput query="qryMyQuery">
<cfswitch expression="#qryMyQuery.recordcount#">
<cfcase value="1"><cfset variables.strNumber = "one"></cfcase>
<cfcase value="2"><cfset variables.strNumber = "two"></cfcase>
<cfcase value="3"><cfset variables.strNumber = "three"></cfcase>
<cfcase value="4"><cfset variables.strNumber = "four"></cfcase>
<cfcase value="5"><cfset variables.strNumber = "five"></cfcase>
<cfcase value="6"><cfset variables.strNumber = "six"></cfcase>
<cfcase value="7"><cfset variables.strNumber = "seven"></cfcase>
<cfcase value="8"><cfset variables.strNumber = "eight"></cfcase>
<cfcase value="9"><cfset variables.strNumber = "nine"></cfcase>
<cfcase value="10"><cfset variables.strNumber = "ten"></cfcase>
<cfcase value="11"><cfset variables.strNumber = "eleven"></cfcase>
<cfcase value="12"><cfset variables.strNumber = "twelve"></cfcase>
<cfcase value="13"><cfset variables.strNumber = "thirteen"></cfcase>
<cfcase value="14"><cfset variables.strNumber = "fourteen"></cfcase>
<cfcase value="15"><cfset variables.strNumber = "fifteen"></cfcase>
<cfcase value="16"><cfset variables.strNumber = "sixteen"></cfcase>
<cfcase value="17"><cfset variables.strNumber = "seventeen"></cfcase>
<cfcase value="18"><cfset variables.strNumber = "eighteen"></cfcase>
<cfcase value="19"><cfset variables.strNumber = "nineteen"></cfcase>
<cfcase value="20"><cfset variables.strNumber = "twenty"></cfcase>
<cfdefaultcase><cfabort showerror="a variety of"></cfdefaultcase>
</cfswitch>
</cfoutput>
Thanks,
PT
putting the "new" in "newb".....