The result of this would be the following:


A recordset that contained the following results: (a,b,c,d,e,f,g,h,I,j)
would be output like this


A   b    c
D   e    f
G   h    i
J


Now, you would just have the expand the inner loop to make a different
output set. Here is the final code.


<cfquery name="mQry" datasource="HCFPROD">
SELECT *
  FROM DC_COMPANY
  ORDER BY VCCOMPANYNAME
</cfquery>


<b>Original Data </b>
<cfoutput query="mQry">
#VCCOMPANYNAME#<br>
</cfoutput>


<br>
<b>Three Column Output data</b>
<cfset NumCols = 3>
<cfset NumRows = mQry.RecordCount / NumCols>
<table>
<cfset SR = 1>
<cfloop index="I" From="1" To=#NumRows#>
<tr>
               
       <cfoutput query="mQry" startrow=#SR# maxrows=#NumCols#>
                                    <td>#VCCOMPANYNAME#</td>
                                    
       </cfoutput>
               <cfset SR = SR+NumCols>
</tr>
</cfloop>
</table>


-----Original Message-----
From: SMR [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 10:17 AM
To: CF-Community
Subject: Re: Formatting Column Output


Possibly, but I already have a loop in my code
  ----- Original Message -----
  From: Schuster, Steven
  To: CF-Community
  Sent: Tuesday, November 25, 2003 10:07 AM
  Subject: RE: Formatting Column Output

  <cfquery name="mQry" datasource="HCFPROD">
  SELECT *
    FROM DC_COMPANY
  </cfquery>

  <cfset NumCols = 3>
  <cfset NumRows = mQry.RecordCount / NumCols>
  <table>
  <cfset Sc=1>
  <cfloop index="I" From="1" To=#NumRows#>
  <tr>
                          
         <cfoutput query="mQry" startrow=#Sc# maxrows="3">
                                      <td>#VCCOMPANYNAME#</td>
                                      <cfset Sc = Sc+2>
         </cfoutput>
  </tr>
  </cfloop>
  </table>

  Is this what you want to do?

  -----Original Message-----
  From: SMR [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, November 25, 2003 9:25 AM
  To: CF-Community
  Subject: Re: Formatting Column Output

  Yes tried that layout and it doesn't work. I'm getting 1 column.
    ----- Original Message -----
    From: Deanna Schneider
    To: CF-Community
    Sent: Tuesday, November 25, 2003 9:15 AM
    Subject: Re: Formatting Column Output

    You mean like this?
    <table>
    <cfoutput query="myquery">

       <cfif myquery.currentrow mod 3 eq 1>
          <tr>
       </cfif>
             <td>#myquery.myfield#</td>
       <cfif myquery.currentrow mod 3 eq 0>
          </tr>
       </cfif>
    </cfoutput>
    </table>

    ----- Original Message -----
    From: "SMR" <[EMAIL PROTECTED]>
    To: "CF-Community" <[EMAIL PROTECTED]>
    Sent: Tuesday, November 25, 2003 7:54 AM
    Subject: Formatting Column Output

    > Here is my code:
    > <table>
    > <cfloop query="getList">
    >
    > <cfoutput query="getSystems">
    > <tr>
    > <td>#system#</td><td><a
href="">     > </tr>
    >
    > </cfoutput>
    >
    > </cfloop>
    > </table>
    >
    >
    > I want to format this so I have 3 seperate columns on the screen.
  example:
    >
    >
    > <tr>
    > <td>#system#</td><td><a
href="">     > <td>#system#</td><td><a
href="">     > <td>#system#</td><td><a
href="">     >
    > </tr>
    >
    > Can not get this to work using the <cfif getsystems.currentrow mod 3
IS
  0>
    statement.  I've tried putting the <cfif> and <tr></tr> tags in every
    combination I can think of but it won't output more then one column.
    >
    > Any suggestions?
    >

    _____  

  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to