Solved

CFLOOP HELP ???

Posted on 2001-08-03
5
233 Views
Last Modified: 2013-12-24
I have a records that a user can pick from a list of check boxes and according to the number of check boxes they pick it will display those records.   I can only get it to find one at a time I need it to find all the records and display all of them.  I pass the record ID in the url as #url.recordID# ex 456,457,458  What I need is a cfloop, can you help me out with that thanks.

Here is the action page.


<cfquery name="getcontact" datasource="bgreports" maxrows=15 dbtype="ODBC">
SELECT      *
FROM         dbo.getcontact
where  id = '#URL.recordid#'
order by dateadded desc
</cfquery>


<cfoutput query="Getcontact" maxrows=15>
<table border="0" width="100%" height="74" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%" height="18" colspan="4">
      <p align="center"><font face="Arial"><b>LEAD CONTACT TRACKING SHEET</b></font></td>
  </tr>
  <tr>
    <td width="100%" height="18" colspan="4">
      <p align="center"></td>
  </tr>
  <tr>
    <td width="27%" height="24">#refname#&nbsp;#relname#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
    <td width="32%" height="24">Sales Associate:&nbsp; #reid# </td>
    <td width="14%" height="24">Assigned To:</td>
    <td width="27%" height="24" valign="bottom">
      <hr width="45%" noshade align="left">
    </td>
  </tr>
  <tr>
    <td width="56%" height="26" colspan="2">#redaytime# (day)&nbsp;&nbsp; #reevening#
      (eve)&nbsp;&nbsp;&nbsp; </td>
    <td width="15%" height="26">Assigned Date:</td>
    <td width="29%" height="26" valign="bottom">
      <hr width="45%" noshade align="left">
    </td>
  </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="36">
  <tr>
    <td width="100%" height="36">
      <hr noshade align="left">
    </td>
  </tr>
  <tr>
    <td width="100%" height="36"><font face="Arial"><b>LEAD INFORMATION</b></font></td>
  </tr>
</table>
<table border="0" width="642" cellspacing="0" cellpadding="0" height="286">
  <tr>
    <td width="129" height="26">Last Market Source:</td>
    <td width="156" height="26">#MarketSource#</td>
    <td width="153" height="26">Referrer's Name:</td>
    <td width="128" height="26">#referrersfname#&nbsp;#referrerslname#</td>
    <td width="67" height="26"></td>
  </tr>
  <tr>
    <td width="129" height="26">Last Mail Code:</td>
    <td width="156" height="26">#mailcode#</td>
    <td width="153" height="26">Referrer's Phone:</td>
    <td width="128" height="26">#referrersphone#</td>
    <td width="67" height="26"></td>
  </tr>
  <tr>
    <td width="129" height="24">Last Offer:</td>
    <td width="156" height="24">#offer#</td>
    <td width="153" height="24">Referrer's Relation:</td>
    <td width="128" height="24">#rerelationship#</td>
    <td width="67" height="24"></td>
  </tr>
  <tr>
    <td width="129" height="21"></td>
    <td width="156" height="21"></td>
    <td width="153" height="21"></td>
    <td width="128" height="21"></td>
    <td width="67" height="21"></td>
  </tr>
  <tr>
    <td width="129" height="21">Lead Name:</td>
    <td width="156" height="21">#refname#&nbsp;#relname#</td>
    <td width="153" height="21">Last Contact Date:</td>
    <td width="128" height="21">#dateformat(contactdate1,"mm-dd-yyyy")#</td>
    <td width="67" height="21"></td>
  </tr>
  <tr>
    <td width="129" height="21">Spouse's Name:</td>
    <td width="156" height="21">#respousefname#&nbsp;#respouselname#</td>
    <td width="153" height="21">Last Contact Status:</td>
    <td width="128" height="21">#Status#</td>
    <td width="67" height="21"></td>
  </tr>
  <tr>
    <td width="129" height="21"></td>
    <td width="156" height="21"></td>
    <td width="153" height="21"></td>
    <td width="128" height="21"></td>
    <td width="67" height="21"></td>
  </tr>
  <tr>
    <td width="129" height="21">Address:</td>
    <td width="156" height="21">#reAddress1#</td>
    <td width="153" height="21">Day Phone:</td>
    <td width="128" height="21">#redaytime#</td>
    <td width="67" height="21"></td>
  </tr>
  <tr>
    <td width="129" height="21"></td>
    <td width="156" height="21">#recity#,&nbsp;&nbsp;&nbsp;#restate#</td>
    <td width="153" height="21">Eve Phone:</td>
    <td width="128" height="21">#REReplace(reevening,".*([0-9]{3}).*([0-9]{3}).*([0-9]{4})","\1-\2-\3")#</td>
    <td width="67" height="21"></td>
  </tr>
  <tr>
    <td width="129" height="21"></td>
    <td width="156" height="21">#rezip#</td>
    <td width="153" height="21">E-mail Address:</td>
    <td width="128" height="21">#reemail#&nbsp; </td>
    <td width="67" height="21"></td>
  </tr>
  <tr>
    <td width="633" colspan="5" height="30"></td>
  </tr>
  <tr>
    <td width="633" colspan="5" height="21">Preliminary Comments:</td>
  </tr>
  <tr>
    <td width="129" height="21"></td>
    <td width="156" height="21"></td>
    <td width="153" height="21"></td>
    <td width="128" height="21"></td>
    <td width="67" height="21"></td>
  </tr>
</table>
<table border="0" width="101%" cellspacing="0" cellpadding="0" height="20">
  <tr>
    <td width="100%" height="20" colspan="8">
      <hr noshade align="left">
    </td>
  </tr>
  <tr></cfoutput>
    <td width="100%" height="20" colspan="8"><font face="Arial"><b>CONTACT
      HISTORY</b></font></td>
  </tr>
  <tr>
    <td width="100%" height="20" colspan="8"></td>
  </tr>
  </table>
<table border="0" width="715" height="40" cellspacing="0" cellpadding="0">
                                             
<TR bgcolor="#FFFFCC" valign="top" height="10">
<td width="80" height="12"><b><font face="Geneva, Arial, Helvetica" size="1" color="##000000">Contact Date</font></b></font></td>
<td width="80"><font face="Geneva, Arial, Helvetica" size="1"><b><font color="##000000">Contact Person</font></b></font></TD>
<td width="80"><font face="Geneva, Arial, Helvetica" size="1"><b><font color="##000000">Contact Type</font></b></font></TD>
<td width="80"><font face="Geneva, Arial, Helvetica" size="1"><b><font color="##000000">Status</font></b></font></TD>
<TD width="80" height="12"><font face="Geneva, Arial, Helvetica" size="1" color="##000000"><b>Call Back</b></font></TD>
<td width="80"><font face="Geneva, Arial, Helvetica" size="1"><b><font color="##000000">MS</font></b></font></TD>
<td width="80"><font face="Geneva, Arial, Helvetica" size="1"><b><font color="##000000">MC</font></b></font></TD>
<td width="80"><font face="Geneva, Arial, Helvetica" size="1"><b><font color="##000000">Offer</font></b></font></TD>

</TR>


<cfoutput query="Getcontact" maxrows=5>
<TR bgcolor="#IIf(CurrentRow Mod 2, DE('white'), DE('FFFFCC'))#" valign="top" height="10">
<td width="80" height="12" style="color: Black; font-size: x-small;">#DateFormat(contactdate1,"mm-dd-yyyy")#</td>
<td width="80" style="color: Black; font-size: x-small">#Contactperson1#</TD>
<TD width="80" style="color: Black; font-size: x-small">
  <p align="left">#contacttype#</p>
</TD>
<td width="80" style="color: Black; font-size: x-small">#status#</td>
<TD width="80" height="12" style="color: Black; font-size: x-small;">#dateformat(callbackdate1,"mm-dd-yyyy")#</TD>
<TD width="80" style="color: Black; font-size: x-small;">#marketsource#</TD>
<TD width="80" height="12" style="color: Black; font-size: x-small;">#mailcode#</TD>
<td width="80" align="left" style="color: Black; font-size: x-small;">#offer#</td>
</TR></cfoutput>
</table>
<table border="0" width="715" cellspacing="0" cellpadding="0">
  <tr>
    <td width="713" height="40" colspan="8"></td>
  </tr>
  <tr>
    <td width="90">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="80" align="left">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
  </tr>
  <tr>
    <td width="90">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="80" align="left">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
  </tr>
   <tr>
    <td width="90">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="80" align="left">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
  </tr>
 <tr>
    <td width="90">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="80" align="left">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
    <td width="100">
      <hr width="90%" noshade align="left">
      <p>&nbsp;</td>
  </tr>
 

  <tr>
    <td width="713" colspan="8"></td>
  </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%">Comments:</td>
  </tr>
</table>

</body>

0
Comment
Question by:cat4larry
  • 3
  • 2
5 Comments
 
LVL 19

Accepted Solution

by:
cheekycj earned 50 total points
Comment Utility
if your form page is such:
<FORM ACTION="action.cfm">
ID 123<INPUT TYPE="checkbox" NAME="recordID" VALUE="123">
ID 234<INPUT TYPE="checkbox" NAME="recordID" VALUE="234"><br>
ID 345<INPUT TYPE="checkbox" NAME="recordID" VALUE="345"><Br>
ID 456<INPUT TYPE="checkbox" NAME="recordID" VALUE="456"><br>
<INPUT TYPE="submit" NAME="Submit" VALUE="Submit">
</FORM>

Then action.cfm query should be:
<CFIF ListLen(URL.recordID) EQ 1>
<cfquery name="getcontact" datasource="bgreports" maxrows=15 dbtype="ODBC">
SELECT      *
FROM  dbo.getcontact
where id = '#URL.recordid#'
order by dateadded desc
</cfquery>
<CFELSEIF LISTLEN(URL.recordID) GT 1)>
<cfquery name="getcontact" datasource="bgreports" maxrows=15 dbtype="ODBC">
SELECT      *
FROM  dbo.getcontact
where id in (#ListQualify(URL.recordID, "'")#)
order by dateadded desc
</cfquery>
<CFELSE>
You didn't select any records
<cfabort>
</cfif>
display code...


I am using ListQualify since it seems that your ID is a string.. if it isn't then you don't need the single quotes in the first query or the listqualify function.

HTH,
CJ

0
 

Author Comment

by:cat4larry
Comment Utility
Thanks CJ, that works, one last thing if you could How can I break up the records so they could be printed Can I insert some kind of page break so they would print individually
0
 
LVL 19

Expert Comment

by:cheekycj
Comment Utility
I am not sure... about this.. since there really is no page break function on the web.

Supposedly this works (but I haven't tried it):
Add a Page break when printing page from browser

<style type="text/css">
.break (pagebreak-after: always)
</style>

Where you want the page break use:

<br class="break">


or check this out:
http://www.webreference.com/js/tips/000201.html

CJ
0
 
LVL 19

Expert Comment

by:cheekycj
Comment Utility
0
 

Author Comment

by:cat4larry
Comment Utility
Thanks CJ for your help I'll let you no if that page break works.  
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now