• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 248
  • Last Modified:

CFLOOP HELP ???

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
cat4larry
Asked:
cat4larry
  • 3
  • 2
1 Solution
 
cheekycjCommented:
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
 
cat4larryAuthor Commented:
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
 
cheekycjCommented:
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
 
cheekycjCommented:
0
 
cat4larryAuthor Commented:
Thanks CJ for your help I'll let you no if that page break works.  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now