• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

number for every record that is retrieved from (query)

Community Beginner ,
Jul 07, 2006 Jul 07, 2006

Copy link to clipboard

Copied

Hello
I wish to put a number for every record that is retrieved from the record that is output by this query

For example
For the first recored/row
Generated number, ksnumber, date
1, gg111 11/05/05
2, oo235 12/06/05

the query returned 2 records 1 and 2 are the number that is generated with this code.
In addition if there is a built in function, where in the code do I put it???


<cfquery name="gelov datasource="kl90">
SELECT
-------------------------------------------

FROM
--------------------------------
WHERE
-----------------------------------------
-----------------------------------------------------

ORDER BY
<cfswitch expression="#Form.orderBy#">
<cfks value="KSNUMBER">
KS.KS_NBR
</cfks>
<cfks value="CREATIONDATE">
KS.KREATDAT
</cfks>
</cfswitch>
</cfquery>

<!---html report--->
<cfswitch expression="#Form.outputFormat#">
<cfks value="HTML">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Ctwye Kss Report</title>
</head>
<style type="text/css">
table{
font-family:Arial, Helvetica, sans-serif;
font-size:10px;
}
td{
font-family:Arial, Helvetica, sans-serif;
font-size:10px;
}
th{
font-family:Arial, Helvetica, sans-serif;
font-size:10px;
}
h2{
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
}
h3{
font-family:Arial, Helvetica, sans-serif;
font-size:13px;
}
</style>

<body>
<cfoutput>
<table border="0" cellpadding="3" cellspacing="0">
<tr>

<td align="center">
<h3>Ctwye Kss Report</h3><br><br></td>
</tr>
<tr>
<td align="center">
</h2>report returned #getCtwyeKss.RecordCount# records</h2></td>
</tr>
<tr>
<td>
<table border="1" cellpadding="2" cellspacing="0">
<tr>

<td width="160">Ks Number</td>
<td>Creation Date</td>
<!--- <td class="dataField">Address</td>
<td class="dataField">Type</td>
<td class="dataField">Description</td>--->
</tr>

<cfloop query="getCtwyeKss">


<tr bgcolor="<cfif currentrow mod 2>GHOSTWHITE<cfelse>WHITE</cfif>">
<td>#KS_NBR#</td>
<td>#dateformat(KREATDAT,"mm/dd/yyyy")#</td>


</tr>
</cfloop>

</table>
</td>
</tr>
</table>

</BODY>
</HTML>
</cfoutput>
</cfks>

<cfks value="CSV">


<CFHEADER NAME="Content-Disposition" VALUE="attachment; filename=ctwye.csv">
<cfcontent type="application/msexcel">"Ks Number","Creation Date"
<cfoutput query="getCtwyeKss">#ltrim(KS_NBR)#,"#dateformat(KREATDAT,"mm/dd/yyyy")#" <tr #IIF(getCtwyeKss.CurrentRow MOD 2,DE(''),DE('backgroundColor="##999"'))#>



<!---<tr bgcolor="<cfif currentrow mod 2>##808080<cfelse>##ffffff</cfif>"> --->
</cfoutput>


</cfks>
</cfswitch>


TOPICS
Advanced techniques

Views

239

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 07, 2006 Jul 07, 2006
<cfks> is not a Coldfusion tag. Use <cfcase> instead.

The following code will print the row numbers

<cfquery name="gelov" datasource="kl90">
select ksnumber, date
from yourTable
</cfquery>

<cfoutput query="gelov">
#currentrow#, #ksnumber#, #date#<br>
</cfoutput>

Votes

Translate

Translate
Community Expert ,
Jul 07, 2006 Jul 07, 2006

Copy link to clipboard

Copied

LATEST
<cfks> is not a Coldfusion tag. Use <cfcase> instead.

The following code will print the row numbers

<cfquery name="gelov" datasource="kl90">
select ksnumber, date
from yourTable
</cfquery>

<cfoutput query="gelov">
#currentrow#, #ksnumber#, #date#<br>
</cfoutput>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation