Solved

CFLOOP HELP ???

Posted on 2001-08-03
5
235 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

943 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

10 Experts available now in Live!

Get 1:1 Help Now