Forums

This topic is locked

Filtered RS will not display same info twice?

Posted 19 May 2004 07:19:56
1
has voted
19 May 2004 07:19:56 Gary Nutter posted:
I am not a newbie...but this one stumps me...

I have a page with two forms...one for approval and one for denial. I filtered my rs to a jobnumber and posted general info about it in the top part of the page. I filtered the rs correctly and it displays the info about the jobnumber...but it will not also drop it into a hdn element in the forms. So I just dropped a layer on the page to see it and sure enough, it will NOT display the data twice. Is there some goofy restriction on displaying the same info two times on the same page.
When I move the layer to the top of the page...the data appears there...but disappears from my other section. It clearly is limiting the number of times it can be displayed.

The general concept is that the info is displayed and depending on the approval or denial of approval the info (which I want in the hd elements in each form) will be inserted into a specific table.

So...can I filter a recordset..display the data about a specific record and hide the same info in two other hdn elements...I am asking those with more wisdom than I...

Thank you,

gary

Replies

Replied 19 May 2004 10:47:08
19 May 2004 10:47:08 Vince Baker replied:
Hi Gary,

Yes you can have as many instances of the results returned by the recordset as you want on a page.

This seems really strange that it worked in a layer but did not show up in your form hidden elements...

Can you post the code here?

Regards
Vince

DMX Talkzone Manager

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 19 May 2004 15:41:36
19 May 2004 15:41:36 Gary Nutter replied:
Vince it is lengthy...Note that the filtered RS displays correctly in line: 291 and 295 but will not display in the hdn elements or the test layer I placed on the page temporarily. BUT..If I move the layer anchor to the top of the page...I will display there but then not on on the other location that was cited above in line 291/295.

Thank you,
gary

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../../Connections/connQual.asp" -->

<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")
If (Request.QueryString <> "" Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert") = "frmapproval" Then

MM_editConnection = MM_connQual_STRING
MM_editTable = "tblQCApproved"
MM_editRedirectUrl = "invoice1.asp"
MM_fieldsStr = "hdnJobNum|value|hdnQCTechLName|value|hdnQCTechFName|value|hdnQCANum|value|hdnQCType|value|hdnQCPay|value|hdnQCMatPay|value|hdnQCApproval|value|hdnQCRegionID|value|hdnQCApprovalDate|value|hdnProb|value|hdnCorrection|value|hdnReviewer|value"
MM_columnsStr = "JobNum|',none,''|QCTLName|',none,''|QCTFNAme|',none,''|QCTANum|',none,''|QCType|',none,''|QCPAyout|none,none,NULL|QCMatCharge|none,none,NULL|Approved|',none,''|RegionID|',none,''|AprovDate|',none,NULL|txtProblem|',none,''|txtCorrection|',none,''|Reviewer|',none,''"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert") = "frmNoApproval" Then

MM_editConnection = MM_connQual_STRING
MM_editTable = "tblQCPendingApproval"
MM_editRedirectUrl = "invoice2.asp"
MM_fieldsStr = "txtComments|value|hdnJobNum2|value|hdnQCTechLName2|value|hdnQCTechFName2|value|hdnQCANum2|value|hdnQCType2|value|hdnQCPay2|value|hdnQCMatPay2|value|hdnQCRegionID2|value|hdnQCReviewedDate2|value|hdnProb2|value|hdnCorrection2|value|hdnReviewer2|value"
MM_columnsStr = "ReviewersComments|',none,''|JobNum|',none,''|QCTLName|',none,''|QCTFNAme|',none,''|QCTANum|',none,''|QCType|',none,''|QCPAyout|none,none,NULL|QCMatCharge|none,none,NULL|RegionID|',none,''|ReviewedDate|',none,NULL|txtProblem|',none,''|txtCorrection|',none,''|Reviewer|',none,''"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert") <> "" Then

' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),","
MM_delim = MM_typeArray(0)
If (MM_delim = "none" Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none" Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none" Then MM_emptyVal = ""
If (MM_formVal = "" Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "" Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'" Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''" & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & " values (" & MM_dbValues & ""

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%
Dim rsCorrectiveAction__MMColParam
rsCorrectiveAction__MMColParam = "1"
If (Request.QueryString("id" <> "" Then
rsCorrectiveAction__MMColParam = Request.QueryString("id"
End If
%>
<%
Dim rsCorrectiveAction
Dim rsCorrectiveAction_numRows

Set rsCorrectiveAction = Server.CreateObject("ADODB.Recordset"
rsCorrectiveAction.ActiveConnection = MM_connQual_STRING
rsCorrectiveAction.Source = "SELECT * FROM tblDBSCorrectiveAction WHERE JobNum = '" + Replace(rsCorrectiveAction__MMColParam, "'", "''" + "'"
rsCorrectiveAction.CursorType = 0
rsCorrectiveAction.CursorLocation = 2
rsCorrectiveAction.LockType = 1
rsCorrectiveAction.Open()

rsCorrectiveAction_numRows = 0
%>
<%
Dim rsInvoice__MMColParam
rsInvoice__MMColParam = "1"
If (Request.QueryString("id" <> "" Then
rsInvoice__MMColParam = Request.QueryString("id"
End If
%>
<%
Dim rsInvoice
Dim rsInvoice_numRows

Set rsInvoice = Server.CreateObject("ADODB.Recordset"
rsInvoice.ActiveConnection = MM_connQual_STRING
rsInvoice.Source = "SELECT * FROM tblQCPayout WHERE JobNum = '" + Replace(rsInvoice__MMColParam, "'", "''" + "'"
rsInvoice.CursorType = 0
rsInvoice.CursorLocation = 2
rsInvoice.LockType = 1
rsInvoice.Open()

rsInvoice_numRows = 0
%>
<%
Dim rsCorporateUsers__MMColParam
rsCorporateUsers__MMColParam = "1"
If (Session("MM_UserName" <> "" Then
rsCorporateUsers__MMColParam = Session("MM_UserName"
End If
%>
<%
Dim rsCorporateUsers
Dim rsCorporateUsers_numRows

Set rsCorporateUsers = Server.CreateObject("ADODB.Recordset"
rsCorporateUsers.ActiveConnection = MM_connQual_STRING
rsCorporateUsers.Source = "SELECT * FROM tblCorporateUsers WHERE LoginID = '" + Replace(rsCorporateUsers__MMColParam, "'", "''" + "'"
rsCorporateUsers.CursorType = 0
rsCorporateUsers.CursorLocation = 2
rsCorporateUsers.LockType = 1
rsCorporateUsers.Open()

rsCorporateUsers_numRows = 0
%>

<html>
<head>
<title>Quality Management System</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../../library/blacklinks.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?")>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="" {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape"&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0">
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr align="left" valign="top">
<td width="76%" bgcolor="#990000"><img src="../../images/header1.gif" width="500" height="100"></td>
<td width="24%" bgcolor="#990000"><img src="../../images/header2.gif" width="2" height="100"></td>
</tr>
<tr>
<td height="22" align="left" valign="top"><!--DWLayoutEmptyCell--> </td>
<td></td>
</tr>
<tr>
<td height="526" align="left" valign="top">
<table width="100%" border="0">
<tr>
<td height="21" colspan="2"> <div align="center"><strong><font color="#990000" size="2" face="Tahoma">
.: Invoice Approval :.</font></strong></div></td>
</tr>
<tr>
<td width="17%" height="25"> <div align="left"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><strong>Job
Number:</strong></font></div></td>
<td width="83%"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><%=(rsInvoice.Fields.Item("JobNum".Value)%></font></td>
</tr>
<tr>
<td height="32">
<div align="left"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><strong>Corrective
Action:</strong></font> </div></td>
<td height="32"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><%=(rsCorrectiveAction.Fields.Item("CorrActRequired".Value)%></font></td>
</tr>
<tr>
<td height="26"> <div align="left"><strong><font size="2" face="Tahoma">Problem:</font></strong></div></td>
<td height="26"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><%=(rsCorrectiveAction.Fields.Item("ProbDesc".Value)%>
</font></td>
</tr>
<tr>
<td height="26">
<div align="left"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><strong>Correction:</strong></font></div></td>
<td height="26"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman">
<%=(rsCorrectiveAction.Fields.Item("CorrectiveAction".Value)%> </font></td>
</tr>
<tr>
<td height="25"> <div align="left"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><strong>QC
Payout:</strong></font></div></td>
<td height="25"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><%= FormatCurrency((rsInvoice.Fields.Item("QCPay".Value), 2, -2, -2, -2) %></font></td>
</tr>
<tr>
<td height="27"> <div align="left"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><strong>Material
Payout:</strong></font></div></td>
<td height="27"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><%= FormatCurrency((rsInvoice.Fields.Item("MatPrice".Value), 2, -2, -2, -2) %></font></td>
</tr>
<tr>
<td height="27"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><strong>Reviewing
Official:</strong></font></td>
<td height="27"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><%=(rsCorporateUsers.Fields.Item("LName".Value)%>, <%=(rsCorporateUsers.Fields.Item("FName".Value)%></font></td>
</tr>
<tr>
<td height="21"><!--DWLayoutEmptyCell--> </td>
<td height="21">
<div id="Layer1" style="position:absolute; width:318px; height:115px; z-index:1; left: 419px; top: 181px; visibility: visible;"><font size="1" face="Tahoma, Arial, Courier New, Courier, Times New Roman">This
layer for display testing purposes only!!!!!!!!!!!!!<br>
<br>
<%=(rsCorrectiveAction.Fields.Item("JobNum".Value)%>,<font color="#990000"><strong><br><%=(rsCorrectiveAction.Fields.Item("ProbDesc".Value)%></strong></font>,</font>
<font size="1" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><br>
<font color="#990000"><strong><%=(rsCorrectiveAction.Fields.Item("CorrectiveAction".Value)%></strong></font>,<br><%=Date()%><br>
</font><br>
</div></td>
</tr>
<tr>
<td height="29">
<div align="left"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"> <img src="../../images/blank_white.gif" width="122" height="8"></font></div></td>
<td height="29" rowspan="2" align="left" valign="top"> <form action="<%=MM_editAction%>" method="POST" name="frmapproval" id="frmapproval">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="submit" name="Submit2" value="Approved"> <input name="hdnJobNum" type="hidden" id="hdnJobNum1" value="<%=(rsInvoice.Fields.Item("JobNum".Value)%>">
<input name="hdnQCTechLName" type="hidden" id="hdnQCTechLName" value="<%=(rsInvoice.Fields.Item("LName".Value)%>">
<input name="hdnQCTechFName" type="hidden" id="hdnQCTechFName" value="<%=(rsInvoice.Fields.Item("FName".Value)%>">
<input name="hdnQCANum" type="hidden" id="hdnQCANum" value="<%=(rsInvoice.Fields.Item("ANum".Value)%>">
<input name="hdnQCPay" type="hidden" id="hdnQCPay" value="<%=(rsInvoice.Fields.Item("QCPay".Value)%>">
<input name="hdnQCMatPay" type="hidden" id="hdnQCMatPay" value="<%=(rsInvoice.Fields.Item("MatPrice".Value)%>">
<input name="hdnQCApproval" type="hidden" id="hdnQCApproval" value="<%=(rsInvoice.Fields.Item("ApprovedforPayment".Value)%>">
<input name="hdnQCRegionID" type="hidden" id="hdnQCRegionID" value="<%=(rsInvoice.Fields.Item("RegionID".Value)%>">
<input name="hdnQCApprovalDate" type="hidden" id="hdnQCApprovalDate" value="<%=Date()%>">
<input name="hdnProb" type="hidden" id="hdnProb" value="<%=(rsCorrectiveAction.Fields.Item("ProbDesc".Value)%>">
<input name="hdnCorrection" type="hidden" id="hdnCorrection" value="<%=(rsCorrectiveAction.Fields.Item("CorrectiveAction".Value)%>">
<input name="hdnReviewer" type="hidden" id="hdnReviewer" value="<%=(rsCorporateUsers.Fields.Item("LoginID".Value)%>">
<input name="hdnQCType" type="hidden" id="hdnQCType" value="<%=(rsInvoice.Fields.Item("QCType".Value)%>">
</td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="frmapproval">
</form></td>
</tr>
<tr>
<td height="18" align="left" valign="top"> <div align="left"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"> </font></div></td>
</tr>
<tr>
<td height="21"><!--DWLayoutEmptyCell-->  </td>
<td height="21"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="13">
<div align="left"><font size="2" face="Tahoma, Arial, Courier New, Courier, Times New Roman"><strong>Comments:</strong></font></div></td>
<td rowspan="4" align="left" valign="top">
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="frmNoApproval" id="frmNoApproval">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><textarea name="txtComments" cols="75" rows="6" id="txtComments"></textarea></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><input name="Submit3" type="submit" onClick="MM_validateForm('txtComments','','R');return document.MM_returnValue" value="Denied Pending Inquiry">
<input name="hdnJobNum2" type="hidden" id="hdnJobNum2" value="<%=(rsInvoice.Fields.Item("JobNum".Value)%>">
<input name="hdnQCTechLName2" type="hidden" id="hdnQCTechLName22" value="<%=(rsInvoice.Fields.Item("LName".Value)%>">
<input name="hdnQCTechFName2" type="hidden" id="hdnQCTechFName2" value="<%=(rsInvoice.Fields.Item("FName".Value)%>">
<input name="hdnQCANum2" type="hidden" id="hdnQCANum2" value="<%=(rsInvoice.Fields.Item("ANum".Value)%>">
<input name="hdnQCType2" type="hidden" id="hdnQCType2" value="<%=(rsInvoice.Fields.Item("QCType".Value)%>">
<input name="hdnQCPay2" type="hidden" id="hdnQCPay2" value="<%=(rsInvoice.Fields.Item("QCPay".Value)%>">
<input name="hdnQCMatPay2" type="hidden" id="hdnQCMatPay2" value="<%=(rsInvoice.Fields.Item("MatPrice".Value)%>">
<input name="hdnQCRegionID2" type="hidden" id="hdnQCRegionID2" value="<%=(rsInvoice.Fields.Item("RegionID".Value)%>">
<input name="hdnQCReviewedDate2" type="hidden" id="hdnQCApprovalDate2" value="<%=Date()%>">
<input name="hdnProb2" type="hidden" id="hdnProb2" value="<%=(rsCorrectiveAction.Fields.Item("ProbDesc".Value)%>">
<input name="hdnCorrection2" type="hidden" id="hdnCorrection2" value="<%=(rsCorrectiveAction.Fields.Item("CorrectiveAction".Value)%>">
<input name="hdnReviewer2" type="hidden" id="hdnReviewer2" value="<%=(rsCorporateUsers.Fields.Item("LoginID".Value)%>">
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="frmNoApproval">
</form>

</td>
</tr>
<tr>
<td height="13"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="28"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="28"><!--DWLayoutEmptyCell--> </td>
</tr>
</table>
</td>
<td> </td>
</tr>
</table>
</body>
</html>
<%
rsCorrectiveAction.Close()
Set rsCorrectiveAction = Nothing
%>
<%
rsInvoice.Close()
Set rsInvoice = Nothing
%>
<%
rsCorporateUsers.Close()
Set rsCorporateUsers = Nothing
%>
Replied 19 May 2004 19:34:06
19 May 2004 19:34:06 Dave Clarke replied:
This has happened to me and I solved it by setting the cursor type of my recordset to "Dynamic", this allows you to display as many items as you like on the same page.

Dave

ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome

Reply to this topic