Solved

CFLOOP HELP ???

Posted on 2001-08-03
5
238 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
ID: 6348967
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
ID: 6349041
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
ID: 6349076
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
ID: 6349077
0
 

Author Comment

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

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Citrix netscaler connection to Web Interface 9 118
Internal DNS Zone Issue 13 74
IIS url rewrite rule for web application 3 60
Web server settings related to keepalive 1 122
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

803 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