and close the cfoutput at the very bottom, of course (they really need a preview page pre-posting answers on this site!)
Main Topics
Browse All TopicsI'm doing a quick and dirty label printing app using ColdFusion for one of our departments. For some reason, the page break doesn't work. I've used similiar code with several different apps. Thanks in advance.... urgent to help save my sanity...
<cfoutput>
<cfset COLCOUNT = 0>
<cfset LOOPCNT = 0>
<cfset LABELCNT = 0>
<cfset COL_1 = ArrayNew(1)>
<cfset COL_2 = ArrayNew(1)>
<cfset COL_3 = ArrayNew(1)>
<cfloop query="qryContacts">
<cfset COLCOUNT = COLCOUNT + 1>
<cfset LOOPCNT = LOOPCNT + 1>
<cfif COLCOUNT eq 1>
<cfset TEMP1 = ArraySet(COL_1, 1,4,0)> <!--- Each Time 1 Is Reached, Clear Array Values --->
<cfset TEMP2 = ArraySet(COL_2, 1,4,0)>
<cfset TEMP3 = ArraySet(COL_3, 1,4,0)>
<cfset COL_1[1] = '#qryContacts.BudgetGroupN
<cfset COL_1[2] = '#qryContacts.ContactName#
<cfset COL_1[3] = '#qryContacts.ContactAddrL
<cfset COL_1[4] = '#qryContacts.ContactAddrL
<cfelseif COLCOUNT eq 2>
<cfset COL_2[1] = '#qryContacts.BudgetGroupN
<cfset COL_2[2] = '#qryContacts.ContactName#
<cfset COL_2[3] = '#qryContacts.ContactAddrL
<cfset COL_2[4] = '#qryContacts.ContactAddrL
<cfelseif COLCOUNT eq 3>
<cfset COL_3[1] = '#qryContacts.BudgetGroupN
<cfset COL_3[2] = '#qryContacts.ContactName#
<cfset COL_3[3] = '#qryContacts.ContactAddrL
<cfset COL_3[4] = '#qryContacts.ContactAddrL
</cfif>
<cfif COLCOUNT eq 3 or LOOPCNT eq #qryContacts.recordcount#>
<cfset LABELCNT = #LABELCNT# + 1>
<table>
<tr>
<td width="230"><cfif #COL_1[1]# gt ''>#COL_1[1]#<cfelse> 
<td width="260"><cfif #COL_2[1]# gt ''>#COL_2[1]#<cfelse> 
<td width="220"><cfif #COL_3[1]# gt ''>#COL_3[1]#<cfelse> 
</tr>
<tr>
<td width="230"><cfif #COL_1[2]# gt ''>#COL_1[2]#<cfelse> 
<td width="260"><cfif #COL_2[2]# gt ''>#COL_2[2]#<cfelse> 
<td width="220"><cfif #COL_3[2]# gt ''>#COL_3[2]#<cfelse> 
</tr>
<tr>
<td width="230"><cfif #COL_1[3]# gt ''>#COL_1[3]#<cfelse> 
<td width="260"><cfif #COL_2[3]# gt ''>#COL_2[3]#<cfelse> 
<td width="220"><cfif #COL_3[3]# gt ''>#COL_3[3]#<cfelse> 
</tr>
<tr>
<td width="230"><cfif #COL_1[4]# gt ''>#COL_1[4]#<cfelse> 
<td width="260"><cfif #COL_2[4]# gt ''>#COL_2[4]#<cfelse> 
<td width="220"><cfif #COL_3[4]# gt ''>#COL_3[4]#<cfelse> 
</tr>
<table>
<cfset COLCOUNT = 0> <!--- Reset Column Count --->
</cfif>
<cfif LABELCNT eq 10>
<p style="page-break-before:a
<img src="../IMAGES/cleardot.gi
<img src="../IMAGES/cleardot.gi
</p>
<cfset LABELCNT = 0>
</cfif>
</cfloop>
</cfoutput>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: dovkatzPosted on 2003-09-03 at 18:59:45ID: 9284539
I'm not going to try understanding the logic behind that. Here's some short and flexible code to accomplish the same effect
etGroupNum ) is "",de(""),de(qryContacts.B udgetGroup Num))#<br> etGroupNum ) is "",de(""),de(qryContacts.C ontactName ))#<br> etGroupNum ) is "",de(""),de(qryContacts.C ontactAddr Line1))#<b r> etGroupNum ) is "",de(""),de(qryContacts.C ontactAddr Line2))#
<!--- change these 2 values--->
<cfset COLS_PER_PAGE=4>
<cfset ROWS_PER_PAGE=10>
<!--- end change ---->
<Cfset RECS_PER_PAGE = COLS_PER_PAGE * ROWS_PER_PAGE>
<cfoutput query="qryContacts">
<CFIF CURRENTROW MOD RECS_PER_PAGE EQ 0>
<table>
</CFIF>
<CFIF CURRENTROW MOD COLS_PER_PAGE EQ 0>
<tr>
</CFIF>
<!--- the part of the loop that always executes ---->
<td>
#iif(trim(qryContacts.Budg
#iif(trim(qryContacts.Budg
#iif(trim(qryContacts.Budg
#iif(trim(qryContacts.Budg
</td>
<!---- end ---->
<CFIF CURRENTROW MOD COLS_PER_PAGE EQ ( COLS_PER_PAGE-1) OR CURRENTROW EQ qryContacts.RECORDCOUNT>
</tr>
</CFIF>
<CFIF CURRENT ROW MOD RECS_PER_PAGE EQ ( RECS_PER_PAGE -1 ) OR CURRENTROW EQ qryContacts.RECORDCOUNT>
</table>
</CFIF>