1 Reply Latest reply on Jul 7, 2006 9:09 AM by BKBK

    number for every record that is retrieved from (query)

    susanring Level 1
      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>