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

Force page break after so many rows with cfquery?

Explorer ,
Jun 28, 2019 Jun 28, 2019

Copy link to clipboard

Copied

Hello, we're using Coldfusion and SQL and are trying to make a page with a query with only one table with one row and need it to force a page break after so many rows for example 50. We could also have it force a page break after 8x11 page is filled. I'm using a header and it will never show the header (theas) on page 2 sense it can't figure out where the page break is. Any help would be great.

<head>

<script>

thead {

position: sticky;

top: 0px;

}

</script>

</head>

<thead>

<table width="100%" cellspacing="2" cellpadding="0" border="0"     align="center" bgcolor="#CCCCCC" contenteditable="false">

<td bgcolor="#EDE9C6" width="5px">

  <div align="center"><nobr><font size="-2">fmt</font></div>

</td>

<td style="overflow:hidden;" bgcolor="#EDE9C6" width="23px">

  <div align="center"><strong><font size="-2">    <nobr>            category               </font></strong></div>

</td>

<td bgcolor="EDE9C6" width="20px">

  <div align="center"><nobr><font size="-2">         SKU         </font></div>

</td>

<td bgcolor="EDE9C6" width="25px">

  <div align="center"><strong><nobr><font size="-2">                          artist                       </font></strong></div>

</td>

<td bgcolor="EDE9C6" width="25px">

  <div align="center"><nobr> <font size="-2">                       title                      </font></div>

</td>

<td bgcolor="EDE9C6" width="5px">

  <div align="center"><strong><nobr><font size="-2"><strong>qs     </strong></font></strong></div>

</td>

<td bgcolor="EDE9C6" width="12px">

  <div align="center"><nobr><font size="-2">fa </font></div></td>

<td bgcolor="EDE9C6" width="12px">

  <div align="center"><strong><font size="-2"><strong>ts </strong>    </font></strong></div>

</td>

<td bgcolor="EDE9C6" width="12px">

  <div align="center"><nobr><font size="-2">wtd </font></div>

</td>

<td bgcolor="EDE9C6" width="12px"><div align="center"><strong><font size="-2">mtd </font></strong></div></td>

<td bgcolor="EDE9C6" width="12px"><div align="center"><font size="-2">ytd </font></div></td>

<td bgcolor="EDE9C6" width="20px">

  <div align="center"><font size="-2"><strong>price</strong></font>

    </div></td>

<td bgcolor="EDE9C6" width="15px">

  <div align="center"><font size="-2">check</font>

  </div></td>

</table></thead>

<table width="100%" cellspacing="2" cellpadding="0" border="0" align="center" bgcolor="#CCCCCC" contenteditable="false">

<tbody>

<cfoutput query="myquery">

<tr>

<td bgcolor="ffffff" width="5px">

  <div align="center"><nobr><font size="-2">#fmt#</font></div>

</td>

<td style="overflow:hidden;" bgcolor="ffffff" width="50px">

  <div align="center"><strong><nobr><font size="-2">#Left(catdesc,20)#    </font></strong></div>

</td>

<td bgcolor="ffffff" width="20px">

  <div align="center"><nobr><font size="-2">#fsku#</font></div>

</td>

<td bgcolor="ffffff" width="25px">

  <div align="center"><strong><nobr><font size="-2">#Left(artist,25)#    </font></strong></div>

</td>

<td bgcolor="ffffff" width="25px">

  <div align="center"><nobr><em><font size="-2">#Left(title,25)#</font>    </em></div>

</td>

<td bgcolor="ffffff" width="8px">

  <div align="center"><strong><nobr><font size="-2">#fUpStkQty#</font>    </strong></div>

</td>

<td bgcolor="ffffff" width="12px">

  <div align="center"><nobr><font size="-2"><cfif #Fas# is not "">X<cfelseif #Fas# is "">  </cfif></font></div></td>

<td bgcolor="ffffff" width="12px">

  <div align="center"><strong><font size="-2">#fStockQty#</font></strong>    </div>

</td>

<td bgcolor="ffffff" width="12px">

  <div align="center"><nobr><font size="-2">#fNSWTD1#</font></div>

</td>

<td bgcolor="ffffff" width="12px"><div align="center"><strong><font size="-2">#fNSMTD1#</font></strong></div></td>

<td bgcolor="ffffff" width="12px"><div align="center"><font size="-2">#fNSYTD1#</font></div></td>

<td bgcolor="ffffff" width="20px">

  <div align="center"><strong><font size="-2">$#fcost#</font></strong>

    </div></td>

<td bgcolor="ffffff" width="15px">

  <div align="center"><font size="-2">             </font>

  </div></td>

</cfoutput></tbody>

</table>

Views

374

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
LEGEND ,
Jul 01, 2019 Jul 01, 2019

Copy link to clipboard

Copied

This:

<script>

thead {

position: sticky;

top: 0px;

}

</script>

.. will never work.  You're placing CSS code within a SCRIPT tag.  This will error, every time.

I also see TD that are not contained within any TR tags.  Where are your rows???

CORRECTION:  I see it.. the one TR.  So what you provided is just the header.  That many columns, you'll have to set up a horizontal scrollbar, unless each column is only one character wide.

I don't fully understand your question.  Is it 'pagination' that you want?  Or are you wanting to output a header followed by 50 records followed by a header followed by 50 records, etc.?  If this is for print, that's understandable.  But I don't think CF has a 'page break' like you'd find in Word.  It can't be done, really, due to all the different browsers, monitor displays, resolution, etc.

The web is quite fluid.

V/r,

^ _ ^

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
LEGEND ,
Jul 01, 2019 Jul 01, 2019

Copy link to clipboard

Copied

Actually, now that I think of it, you'd be better off using a non-scrolling header at the top of the page, and let the database values scroll underneath it, if you have that many records.

HTH,

^ _ ^

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
Participant ,
Jul 01, 2019 Jul 01, 2019

Copy link to clipboard

Copied

The only way to get true page breaks for a report type output is to use CFDOCUMENT and output a PDF then you can insert

<cfdocumentitem type="pagebreak">  to force a page break.

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
Explorer ,
Jul 02, 2019 Jul 02, 2019

Copy link to clipboard

Copied

I'm trying not to use CFDOCUMENT. I keep having issues with css and it making the font extra small when I try using CFDOCUMENT  with the header and footer options.

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
Participant ,
Jul 02, 2019 Jul 02, 2019

Copy link to clipboard

Copied

LATEST

I have never had any luck with separate CSS, seems to work if you add it in line on the elements. You could also take a look at this thread https://forums.adobe.com/thread/121088

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