Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Adobe Report Writer CF 8 - Mailing Label Woes

Posted on 2008-10-17
1
Medium Priority
?
458 Views
Last Modified: 2013-12-24
I am tryibng to create some maining labels from a select set in ColdFusion. I have edited my Avery_5160.cfr so that it contains 4 lines:
query.name
query.names2
query.address
query.city & ", " & query.state & " " & query.zip

I have no problem printing a label with for lines except when there is no value for query.names2 for a record. It prints a blank space. What I am trying to do is, if query.names2 is empty then put a black in the first line and put query.name into the second line.
Here is my CF code to do this:
...................
<cfquery name="QryData" datasource="#session.controller.datasource#">
 SELECT *
 FROM #rd_info.TABLE_NAME#
 WHERE results_session_id = #get_res_sess_id.results_session_id#
 </cfquery>
 
<cfset QryLabels = QueryNew("name,names2,street,city,state,zip")>
 
<cfloop query="QryData">
 	<cfset tmp = QueryAddRow(QryLabels)>
 
 <cfif len(trim(attributes.attribute12))> 
    <cfset tmp = QuerySetCell(QryLabels, "name", QryData[#attributes.attribute11#][CurrentRow])>
    <cfset tmp = QuerySetCell(QryLabels, "names2", QryData[#attributes.attribute12#][CurrentRow])>	
<cfelseif len(trim(attributes.attribute11))>
	    	<cfset tmp = QuerySetCell(QryLabels, "names2", QryData[#attributes.attribute11#][CurrentRow])>
 <cfelse>
  	<cfoutput><script>alert('No name fields selected');self.history.back();</script></cfoutput>
  	<cfabort>
 </cfif>
 
 <cfif len(trim(attributes.attribute21)) and len(trim(attributes.attribute22)) and len(trim(attributes.attribute23)) >
  <cfset tmp = QuerySetCell(QryLabels, "street", QryData[#attributes.attribute21#][CurrentRow] & " " & 
 
QryData[#attributes.attribute22#][CurrentRow] & " " & QryData[#attributes.attribute23#][CurrentRow])>
 <cfelseif len(trim(attributes.attribute21)) and len(trim(attributes.attribute22)) >
  <cfset tmp = QuerySetCell(QryLabels, "street", QryData[#attributes.attribute21#][CurrentRow] & " " & 
 
QryData[#attributes.attribute22#][CurrentRow])>
 <cfelseif len(trim(attributes.attribute21)) >
  <cfset tmp = QuerySetCell(QryLabels, "street", QryData[#attributes.attribute21#][CurrentRow])>
 <cfelse>
  <cfoutput><script>alert('No address fields selected');self.history.back();</script></cfoutput>
  <cfabort>
 </cfif>
 
 <cfif len(trim(attributes.attribute31)) and len(trim(attributes.attribute32)) and len(trim(attributes.attribute33)) >
  <cfset tmp = QuerySetCell(QryLabels, "city", QryData[#attributes.attribute31#][CurrentRow])>
  <cfset tmp = QuerySetCell(QryLabels, "state", QryData[#attributes.attribute32#][CurrentRow])>
  <cfset tmp = QuerySetCell(QryLabels, "zip", QryData[#attributes.attribute33#][CurrentRow])>
 <cfelseif len(trim(attributes.attribute31)) and len(trim(attributes.attribute32)) >
  <cfset tmp = QuerySetCell(QryLabels, "city", QryData[#attributes.attribute31#][CurrentRow])>
  <cfset tmp = QuerySetCell(QryLabels, "state", QryData[#attributes.attribute32#][CurrentRow])>
 <cfelseif len(trim(attributes.attribute31)) and len(trim(attributes.attribute33)) >
  <cfset tmp = QuerySetCell(QryLabels, "city", QryData[#attributes.attribute31#][CurrentRow])>
  <cfset tmp = QuerySetCell(QryLabels, "zip", QryData[#attributes.attribute33#][CurrentRow])>
  <cfif Len(Trim(attributes.default_state_value))>
  <cfset tmp = QuerySetCell(QryLabels, "state", attributes.default_state_value)>
  </cfif>
 <cfelseif len(trim(attributes.attribute31)) >
  <cfset tmp = QuerySetCell(QryLabels, "city", QryData[#attributes.attribute31#][CurrentRow])>
 <cfelse>
  <cfoutput><script>alert('No city, state, name fields selected');self.history.back();</script></cfoutput>
  <cfabort>
 </cfif>
</cfloop>
................

Open in new window

0
Comment
Question by:apwbe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 10

Accepted Solution

by:
Mause earned 1400 total points
ID: 22954667
I think you should change the cfif statement because the value of attributes.attribute12 is not changing but the query values are:

<cfif len(trim( QryData[#attributes.attribute12#][CurrentRow]))>
   <cfset tmp = QuerySetCell(QryLabels, "name", QryData[#attributes.attribute11#][CurrentRow])>
   <cfset tmp = QuerySetCell(QryLabels, "names2", QryData[#attributes.attribute12#][CurrentRow])>  
<cfelseif len(trim( QryData[#attributes.attribute11#][CurrentRow]))>
                <cfset tmp = QuerySetCell(QryLabels, "names2", QryData[#attributes.attribute11#][CurrentRow])>
 <cfelse>
        <cfoutput><script>alert('No name fields selected');self.history.back();</script></cfoutput>
        <cfabort>
 </cfif>

0

Featured Post

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question