could you use the query.recordcount here? 30 - #qGetAddresses.recordcount# will give you the amount of labels to print with the return address
On 6/29/07, Gary Strommen <[EMAIL PROTECTED]> wrote: > Sorry about the header, couldn't think of a better way to phrase this > question. > > I have created a coldfusion report (CFR) that pulls from a query and prints > out mailing labels on an avery 5160. This specific label sheet holds 30 > labels. Almost all the queries that this will ever pull will be less than 30 > records. Instead of wasting the blank labels, I would like to have a default > address printed for the remaining labels (I.E. the return address). I am not > sure the best way to go about this. > > This hardest part to get around is that the CFR can only pull from one query > at a time. I thought about trying to do a nesting query (a query within a > query) but as I have read on this site, it really is not a good idea, if it > is even possible at all. Nevertheless, I will need multiple queries... the > first being for a recordcount. > > <cfquery name="qGetAddresses" datasource="xxx"> > SELECT fName, MI, lName, stName, aptNo, city, state, zipCode, classNo > FROM students > WHERE classNo = '#sectionName#' > </cfquery> > > I have placed the default address into the students table as well as a single > record and in that record, I have named the classNo "ALL". I was thinking of > trying something like this for the second query but this obviously does not > work: > > <cfset labelCount = "30"> > > <cfquery name="qGetFullSheet" datasource="xxxx"> > SELECT fName, MI, lName, stName, aptNo, city, state, zipCode, classNo > FROM students > <cfloop index="loopCount" from="#qGetAddress.recordCount#" > to="#labelCount#"> > WHERE classNo = 'ALL' > </cfloop> > </cfquery> > > Ideally, what I am trying to do is to grab the records (in my test case, > there are actually 19 records) and then for the remaining records (11 in this > case), return the default address (the return address) all in one query. It > has to be one query as it is being sent to the CFR. Unless of course, you > can send multiple queries to the same CFR at the same time. > > Thanks in advance. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ColdFusion MX7 and Flex 2 Build sales & marketing dashboard RIAâs for your business. Upgrade now http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT Archive: http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2882 Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
