[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

Pulling in URL.RecordID to select records to display - user can then enter name in search box and return results to same form

Asked by JeannetteRobinsonCooley in ColdFusion Application Server

Tags: display, query, recordid, select

1) URL.RecordID pulls data from query on entering form.
2) Records displayed.
3) User enters search criteria to display records from initial query routine.
4) User can clear search box and return original records displayed from initial URL.RecordID.

Problem: 1 & 2 works however when next and/or back button selected all the records in the table are displayed instead of the original records selected by the URL.RecordID.

Once the user enters search criteria I get an error because there are two tables: tblCaseNames and tblPlaintiffData.  The CaseID in tblCaseNames is matched to the URL.RecordID then the CaseID in tblCaseNames is matched to the CaseID in tblPlaintiffData.

Appears that it bombs when it goes to matchup the CaseID with the CaseID pulled in from the search routine.

Having a problem using SESSION to capture what the user entered into the search box (also trying to store the case id for that record) so that when the search box is cleared it knows what case id was originally passed when the form was initially entered using the URL.RecordID.

Also the next and back buttons pulls up all the records not what was displayed using the search filter.

I think I have made this too complicated but can't believe that others have not done what I'm trying to do.

So now I'm asking the experts for their help.  Here's the code.
<cfparam name="URL.CaseID" default="1">
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfparam name="URL.RecordID" default="">
<cfparam name="URL.chkSample" default="">
<cfparam name="PageNum_recordset1" default="1">
<CFPARAM name="url.sort" default="PlaintiffName">


<!--- If user is submitting the "filter" form,  --->
<!--- we'll make their submission be the filter for the rest of session --->
<CFIF IsDefined("FORM.LookupData.UserData")>
  <CFSET SESSION.tblPlaintiffData.UserFilter = FORM.LookupData.UserData>
  <CFSET SESSION.tblPlaintiffData.GetID = FORM.LookupData.LookupCaseID>
<CFELSE>
  <CFSET SESSION.tblPlaintiffData.UserFilter = "">
  <CFSET SESSION.tblPlaintiffData.GetID = #URL.RecordID#>
</CFIF>

<CFIF URL.RecordID is "">
  URL.RecordID = SESSION.tblPlaintiffData.GetID
</CFIF>
<cfquery name="Recordset2" datasource="TexasWebAppPc">
    SELECT *
       FROM dbo.tblCaseNames
         <CFIF IsDefined('FORM.LookupData.UserData')>
           WHERE CaseID = Form.LookupData.LookupCaseID
            <CFELSE>
         WHERE CaseID = #URL.RecordID#
</CFIF>

</cfquery>

<!--- If this is the first time in the form get the URL.RecordID --->
<!--- Retrieve case records from database --->
<cfquery name="Recordset1" datasource="TexasWebAppPc">
     SELECT * FROM tblPlaintiffData WHERE
      
       <CFIF SESSION.tblPlaintiffData.UserFilter IS NOT "">
          0=0
          AND (PlaintiffName LIKE '%#SESSION.tblPlaintiffData.UserFilter#%')
       <CFELSE>
          CaseID = #URL.RecordID#
       </CFIF>
     ORDER BY #url.sort#
</cfquery>
 

<cfquery name="GetTotalRecords" datasource="TexasWebAppPc">
       SELECT Count(*) as TotalRecords
         FROM tblPlaintiffData
</cfquery>
    <!--- Number of rows to display per Next/Back page --->
<CFSET RowsPerPage = 10>
<!--- What row to start at? Assume first by default --->
<CFPARAM NAME="URL.StartRow" DEFAULT="1" TYPE="numeric">
<!--- Allow for show all parameter in the URL --->
<CFPARAM NAME="URL.ShowAll" TYPE="boolean" DEFAULT="No">


<!--- We know the total number of rows from query --->
<CFSET TotalRows = recordset1.recordcount>
<!---
<!--- Show all on page if showall passed in url --->
<CFIF URL.ShowAll>
  <CFSET RowsPerPage = TotalRows>
</CFIF>
--->
<!--- Last row is 10 rows past the starting row, or --->
<!--- total number of query rows, whichever is less --->
<CFSET EndRow = Min(URL.StartRow + RowsPerPage - 1, TotalRows)>
<!--- Next button goes to 1 past current end row --->
<CFSET StartRowNext = EndRow + 1>
<!--- Back button goes back N rows from start row --->
<CFSET StartRowBack = URL.StartRow - RowsPerPage>

<html>
<head>
<title>Form1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK REL=stylesheet HREF="mystyles.css" TYPE="text/css">
<script language = "Javascript">
<!--
/**
 * DHTML check all/clear all links script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

var form='frmSample' //Give the form name here

function SetChecked(val,chkName) {
dml=document.forms[form];
len = dml.elements.length;
var i=0;
for( i=0 ; i<len ; i++) {
if (dml.elements[i].name==chkName) {
dml.elements[i].checked=val;
}
}
}

function ValidateForm(dml,chkName){
len = dml.elements.length;
var i=0;
for( i=0 ; i<len ; i++) {
if ((dml.elements[i].name==chkName) && (dml.elements[i].checked==1)) return true

}
alert("Please select at least one record to be deleted")
return false;
}
// -->
</script>
</head>
<body topmargin="0">
<h2 align="center">Texas Echo Tracking Database Plaintiff Lookup</h2>
 <!--- Simple style sheet for formatting --->
  <STYLE>
    TH {font-family:sans-serif;font-size:smaller;
           background:navy;color:white}
      TH  {font-family:sans-serif;font-size:smaller}
      TD.DataA {background:silver;color:black}
      TD.DataB {background:lightgrey;color:black}
  </STYLE>
   <CFFORM name=LookupData action="#CGI.SCRIPT_NAME#" method="post">
 
   <!--- Filter string --->
   <B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<font size="2">Filter by Plaintiff Name:</font></B>
  <cfinput
      type="text"
        name="UserData"
        value="#SESSION.tblPlaintiffData.UserFilter#"
        size="30">
        <cfinput
          type="text"
            name="LookupCaseID"
            value="#SESSION.tblPlaintiffData.GetID#">
        <!--- Submit button to activate/change/clear filter --->
        <input
          type="submit"
            value="Apply">
  </CFFORM>

 <cfform name="frmSample" method="post" action="NewDeleteRecord.cfm?recordid=#recordset1.plaintiffid#" onSubmit="return ValidateForm(this,'chkSample')">
   <div align="center">
     <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input type='submit' name="" value='Delete Records'>&nbsp;
       <a href="javascript:SetChecked(1,'chkSample')" class="brownsubtitle"><font face="Times New Roman, Times, serif"
          size="1">&nbsp;&nbsp;Check All</font></a>&nbsp;
            <a href="javascript:SetChecked(0,'chkSample')" class="brownsubtitle">
         <font face="Times New Roman, Times, serif" size="1">&nbsp;&nbsp;Clear All</font></a>
       <!--- your dynamic table contents comes here (change the name chkSample everywhere if you want to)--->
     
   <table width="83%" height="104" border="6" align="center" cellpadding="0" cellspacing="0">
           <tr>
   <td colspan="4">
  <!--- Message about which rows are being displayed--->
   <cfoutput>
   <font size="1">&nbsp;&nbsp;Displaying <B>#URL.StartRow#</B> to <B>#EndRow#</B>
   of <B>#TotalRows#</B> Records<BR></font>
</cfoutput>
   </TD>
   <td colspan="5">&nbsp;&nbsp;&nbsp;
   <!--- Provide Next/Back links --->
   <CFINCLUDE TEMPLATE=NextNIncludeBackNext.cfm>
   </TD>
   </TR>
            <tr>
          <th width="22%" bgcolor="#FFB895"><u>Case Name/Case ID</u></th>
          <th width="33%" bgcolor="#FFB895"><u>Plaintiff Name</u></th>
          <th width="12%" bgcolor="#FFB895"><u>Plaintiff ID/CaseID</u></th>
          <th width="18%" bgcolor="#FFB895"><div align="center"><u>Status</u></div></th>
          <th width="11%" bgcolor="#FFB895"><div align="center"><u>Challenged By</u></font></div></th>
               <th width="11%" bgcolor="#FFB895">Delete Record</th>
              <td></td>
              <td></td>
     </tr>
             <tr>
             <!--- For each query row that should be shown now --->
             <CFLOOP query="recordset1" StartRow="#URL.STartRow#" EndRow="#EndRow#">
             <!--- Use class "DataA" or "DataB" for alternate rows --->
             <CFSET Class = IIF(recordset1.CurrentRow MOD 2 EQ 0, "'DataA'", "'DataB'")>
             <cfoutput>
                 <td bgcolor="##FFFFFF"><font size="1">&nbsp;&nbsp;#recordset2.CaseName#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#recordset2.CaseID#</font></td>
             </cfoutput>
                    <CFOUTPUT>
                <td bgcolor="##FFFFFF"><a href="UpdatePlaintiffData.cfm?recordID=#recordset1.PlaintiffID#"><font size="1">&nbsp;#recordset1.PlaintiffName#</font></a></td>
            <td bgcolor="##FFFFFF"><div align="center"><font size="1">#recordset1.PlaintiffID#&nbsp;/&nbsp;#recordset1.caseid#</font></div>
           </td>
            <td bgcolor="##FFFFFF"><div align="center"><font size="1">#recordset1.Status#</font></div></td>
            <td width="11%" bgcolor="##FFFFFF"><div align="center"><font size="1">#DateFormat("#recordset1.ChallengedBy#",
                "mm/dd/yyyy")#</font></div>
           </td>
           <td align="center"><input type="checkbox" name="chkSample" value="#PlaintiffID#">
               </td>
         </tr>
                  </cfoutput>
             
         </CFLOOP>
        
         <!--- Row at bottom of table, after rows of data --->
  <!---  <tr>
   <td width="100" align="right">
   <!--- Provide Next/Back links --->
    <CFINCLUDE TEMPLATE=NextNIncludeBackNext.cfm>
   </td>
  </TR> --->
</table>
  <table width="51%" align="center">
        <tr>
            <td width="30%"><div align="left">&nbsp;<strong><a href="CaseMasterDetail.cfm">&nbsp;Case Name Lookup</a></strong></div>
   </td>
               <td width="45%"><div align="left">&nbsp;<strong><a href="Index2.cfm">&nbsp;Main Menu</a></strong></div></td>
             <td width="12%">&nbsp;</td>
   <td width="13%">&nbsp;</td>
    </tr>
</table>
   </cfform>
</body>
</html>

[+][-]10/27/04 01:53 PM, ID: 12427057Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: ColdFusion Application Server
Tags: display, query, recordid, select
Sign Up Now!
Solution Provided By: smaglio81
Participating Experts: 1
Solution Grade: A
 
[+][-]12/01/04 08:30 AM, ID: 12717558Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]12/05/04 02:12 AM, ID: 12747378Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93