...

View Full Version : Please show/teach me how to change case select to loop all case please



cs168
08-11-2005, 03:56 PM
Hi I am new in ASP programming so I do use the very basic and simple way to do all my stuff. Now I do really got stuck at how can I loop thru the calculation for all my selection.. My full code is as below:-

<%
tBegin = request("beginww")
tEnd = request("endww")
tPkg = request("pkgtype")
tYear = request("wwyear")
%>
<body>

<form name= "frmbrowsepkg" method="POST">
Year: <select name="wwyear" id="wwyear">
<%if tYear = "" then tYear = Year(date)
for t = 2005 to tYear%>
<option value="<%=t%>" <%if t = cint(tYear) then%>selected<%end if%>><%=t%></option>
<%next%>
</select>
&nbsp;
Start Week: <select name="beginww" id="beginww">
<% if tBegin = "" then tBegin = 1
for t = 1 to 53%>
<option value="<%=t%>" <%if t = cint(tBegin) then%>selected<%end if%>><%=t%></option>
<%next%>
</select>
&nbsp;
End Week: <select name="endww" id="endww">
<% if tEnd = "" then tEnd = 1
for t = 1 to 53%>
<option value="<%=t%>" <%if t = cint(tEnd) then%>selected<%end if%>><%=t%></option>
<%next%>
</select>
&nbsp;
Package Type:
<select name="pkgtype" id="pkgtype">
<option Value="P">All Pkg
<option value="G"> All Green Pkg
<option Value = "128">PQFP128
<option Value = "208">PQFP208
<option Value = "PK100">PK100
<option Value = "PK128">PK128
<option value="<%=pkgtype%>"Selected</option>
</select>

<INPUT TYPE="submit" runat="server" VALUE="Cal CPK"></INPUT>
</form>
<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
%>

<table width="100%" align="center" bgcolor="#0d5692">
<tr>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>PKG Type</b></font></td>
<td width="5%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>Mean</b></font></td>
<td width="5%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>Average<br>Moving Range</b></font></td>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>UCL</b></font></td>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>LCL</b></font></td>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>Total<br>Record</b></font></td>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>Range<br>Mean</b></font></td>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>Range<br>UCL</b></font></td>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>Range<br>LCL</b></font></td>
<td width="5%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>CPK</b></font></td>
<td width="5%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>CP</b></font></td>
</tr>

<%
SET RS=CreateObject("ADODB.Recordset") 'create a recordset
select case request ("pkgtype")
case "P"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Not Like '%G%' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "All Sn/Pb Pkg"
case "G"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%G%' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "All Green Pkg"
case "208"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%208' and Pkgtype Not Like '%G208' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "PQFP 208"
case "128"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%128' and Pkgtype Not Like '%G128' and Pkgtype Not Like '%PK128' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "PQFP 128"
case "PK100"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK100' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "PK 100"
case "PK128"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK128' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "PK 128"
End select
RS.Open sql,conn,1,2
sMsg = " No Data Within The WorkWeek you Select Please Select Others WorkWeek."
if rs.recordcount < 1 Then
response.write (sMsg)
else
if rs.recordcount >= 30 then
SET RS=CreateObject("ADODB.Recordset") 'create a recordset
select case request ("pkgtype")
case "P"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Not Like '%G%' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "G"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%G%' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "208"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%208' and Pkgtype <> '%G208' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "128"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%128' and Pkgtype <>'%G128' and Pkgtype <> '%PK128%' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "PK100"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK100' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "PK128"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK128' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
End select
else
SET RS=CreateObject("ADODB.Recordset") 'create a recordset
select case request ("pkgtype")
case "P"
sql="select Top 30 Avg1, Range1, PkgType from tblFiles where Pkgtype Not Like '%G%' and workweek <= " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "G"
sql="select Top 30 Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%G%' and workweek <= " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "208"
sql="select Top 30 Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%208' and Pkgtype <> '%G208' and workweek <= " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "128"
sql="select Top 30 Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%128' and Pkgtype <> '%G128' and Pkgtype <> '%PK128%' and workweek <= " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "PK100"
sql="select Top 30 Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK100' and workweek <= " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "PK128"
sql="select Top 30 Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK128' and workweek <= " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
End select
end if
Rs.open sql,conn,1,2
prioravg1 = -1
tavg1=0
tdiffavg1=0
trange1=0
count=0%>

<%
Do until rs.eof
avg1 = RS("avg1")
range1= rs("range1")
diffavg1 = 0
If prioravg1 >= 0 Then diffavg1 = ABS( avg1 - prioravg1 ) 'get the mrange of every avg1 and avg1
'===========================================================================================
count = count + 1
trange1= trange1 + range1
Range1ave= trange1/ count ' Get the range Average
Rucl = 1.652 * range1ave ' get the range chart UCL
Rlcl = 0.348 * range1ave' get the range chart LCL
sigma = range1ave / 3.472 ' get the sigma for sample size =15 = 3.472
sixsigma = 6 * sigma
specmean = 800 - 300 ' USl - LSL
cp= specmean / sixsigma ' get the process cp

'===============================================
tavg1 = tavg1 + avg1
tdiffavg1 = tdiffavg1 + diffavg1
atavg1= tavg1 / count ' get the average of avg1
if rs.recordcount > 1 then Rcount = rs.recordcount - 1
if rs.recordcount = 1 then Rcount = 1
atdiffavg1= tdiffavg1 / Rcount ' /////////' get the average of moving range
'=======================================================
UCL = atavg1 + (2.66 * atdiffavg1) ' get the UCL
LCL = atavg1 - (2.66 * atdiffavg1) ' get the LCL
'===================================================
'Below code is to get the CPK
USL = 800 ' upper spec limit
LSL = 300 ' lower spec limit
tsigma= 3 * sigma ' get 3 sigma to calculate the cpk
UCpu = USL - atavg1 ' USL = 800 - atavg1
Cpu = UCpu / tsigma ' get the cpu
UCpl = atavg1 - LSL 'atavg1 - LSL = 300
Cpl = UCpl / tsigma ' get cpl0u
if Cpu > Cpl then Cpk = Cpl ' compare cpu and cpl get the lower value as cpk
if Cpl >= Cpu then Cpk = Cpu

prioravg1=avg1
rs.movenext
Loop%>

<tr>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=Pkgid%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(atavg1,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(atdiffavg1,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(UCL,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(LCL,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=count%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(Range1ave,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(Rucl,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(Rlcl,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=Formatnumber(cpk,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(cp,2)%></font></Td><br>
</tr>
<tr>
<td colspan="12" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>
Plating Thickness SPC Control Chart Limit and CPK Data For <%=Ucase(Pkgid)%> From WW <%=tBegin%> To WW <%=tEnd%>.
</font></b></td></tr>
<%end if
end if%>
</table>

As of now I only can get the data in one row which depend on what I select, can I have all data in one table by one click? Pls help tks a lot....
In short I want all my ouput in one table rather then select it one b one...

neocool00
08-11-2005, 04:51 PM
If you want to display all the rows of your recordset, move your html code inside of your Do...Loop. I think the best place to put it would be before the .movenext line.

cs168
08-11-2005, 05:48 PM
If you want to display all the rows of your recordset, move your html code inside of your Do...Loop. I think the best place to put it would be before the .movenext line.
Hi Tks for helping, Can you be more specific on moving the html code into the do...loop, I am new in asp programming, did I need to take away my select case line? Where should I insert the do...loop, pls feel free to explain a bit more.Appreciated your help.tks...

neocool00
08-11-2005, 09:30 PM
Changes are in red.

<%
tBegin = request("beginww")
tEnd = request("endww")
tPkg = request("pkgtype")
tYear = request("wwyear")
%>
<body>

<form name= "frmbrowsepkg" method="POST">
Year: <select name="wwyear" id="wwyear">
<%if tYear = "" then tYear = Year(date)
for t = 2005 to tYear%>
<option value="<%=t%>" <%if t = cint(tYear) then%>selected<%end if%>><%=t%></option>
<%next%>
</select>
&nbsp;
Start Week: <select name="beginww" id="beginww">
<% if tBegin = "" then tBegin = 1
for t = 1 to 53%>
<option value="<%=t%>" <%if t = cint(tBegin) then%>selected<%end if%>><%=t%></option>
<%next%>
</select>
&nbsp;
End Week: <select name="endww" id="endww">
<% if tEnd = "" then tEnd = 1
for t = 1 to 53%>
<option value="<%=t%>" <%if t = cint(tEnd) then%>selected<%end if%>><%=t%></option>
<%next%>
</select>
&nbsp;
Package Type:
<select name="pkgtype" id="pkgtype">
<option Value="P">All Pkg
<option value="G"> All Green Pkg
<option Value = "128">PQFP128
<option Value = "208">PQFP208
<option Value = "PK100">PK100
<option Value = "PK128">PK128
<option value="<%=pkgtype%>"Selected</option>
</select>

<INPUT TYPE="submit" runat="server" VALUE="Cal CPK"></INPUT>
</form>
<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
%>

<table width="100%" align="center" bgcolor="#0d5692">
<tr>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>PKG Type</b></font></td>
<td width="5%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>Mean</b></font></td>
<td width="5%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>Average<br>Moving Range</b></font></td>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>UCL</b></font></td>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>LCL</b></font></td>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>Total<br>Record</b></font></td>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>Range<br>Mean</b></font></td>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>Range<br>UCL</b></font></td>
<td width="7%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>Range<br>LCL</b></font></td>
<td width="5%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>CPK</b></font></td>
<td width="5%" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>CP</b></font></td>
</tr>

<%
SET RS=CreateObject("ADODB.Recordset") 'create a recordset
select case request ("pkgtype")
case "P"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Not Like '%G%' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "All Sn/Pb Pkg"
case "G"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%G%' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "All Green Pkg"
case "208"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%208' and Pkgtype Not Like '%G208' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "PQFP 208"
case "128"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%128' and Pkgtype Not Like '%G128' and Pkgtype Not Like '%PK128' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "PQFP 128"
case "PK100"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK100' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "PK 100"
case "PK128"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK128' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "PK 128"
End select
RS.Open sql,conn,1,2
sMsg = " No Data Within The WorkWeek you Select Please Select Others WorkWeek."
if rs.recordcount < 1 Then
response.write (sMsg)
else
if rs.recordcount >= 30 then
SET RS=CreateObject("ADODB.Recordset") 'create a recordset
select case request ("pkgtype")
case "P"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Not Like '%G%' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "G"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%G%' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "208"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%208' and Pkgtype <> '%G208' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "128"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%128' and Pkgtype <>'%G128' and Pkgtype <> '%PK128%' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "PK100"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK100' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "PK128"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK128' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
End select
else
SET RS=CreateObject("ADODB.Recordset") 'create a recordset
select case request ("pkgtype")
case "P"
sql="select Top 30 Avg1, Range1, PkgType from tblFiles where Pkgtype Not Like '%G%' and workweek <= " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "G"
sql="select Top 30 Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%G%' and workweek <= " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "208"
sql="select Top 30 Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%208' and Pkgtype <> '%G208' and workweek <= " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "128"
sql="select Top 30 Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%128' and Pkgtype <> '%G128' and Pkgtype <> '%PK128%' and workweek <= " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "PK100"
sql="select Top 30 Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK100' and workweek <= " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
case "PK128"
sql="select Top 30 Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK128' and workweek <= " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
End select
end if
Rs.open sql,conn,1,2
prioravg1 = -1
tavg1=0
tdiffavg1=0
trange1=0
count=0%>

<%
Do until rs.eof
avg1 = RS("avg1")
range1= rs("range1")
diffavg1 = 0
If prioravg1 >= 0 Then diffavg1 = ABS( avg1 - prioravg1 ) 'get the mrange of every avg1 and avg1
'===========================================================================================
count = count + 1
trange1= trange1 + range1
Range1ave= trange1/ count ' Get the range Average
Rucl = 1.652 * range1ave ' get the range chart UCL
Rlcl = 0.348 * range1ave' get the range chart LCL
sigma = range1ave / 3.472 ' get the sigma for sample size =15 = 3.472
sixsigma = 6 * sigma
specmean = 800 - 300 ' USl - LSL
cp= specmean / sixsigma ' get the process cp

'===============================================
tavg1 = tavg1 + avg1
tdiffavg1 = tdiffavg1 + diffavg1
atavg1= tavg1 / count ' get the average of avg1
if rs.recordcount > 1 then Rcount = rs.recordcount - 1
if rs.recordcount = 1 then Rcount = 1
atdiffavg1= tdiffavg1 / Rcount ' /////////' get the average of moving range
'=======================================================
UCL = atavg1 + (2.66 * atdiffavg1) ' get the UCL
LCL = atavg1 - (2.66 * atdiffavg1) ' get the LCL
'===================================================
'Below code is to get the CPK
USL = 800 ' upper spec limit
LSL = 300 ' lower spec limit
tsigma= 3 * sigma ' get 3 sigma to calculate the cpk
UCpu = USL - atavg1 ' USL = 800 - atavg1
Cpu = UCpu / tsigma ' get the cpu
UCpl = atavg1 - LSL 'atavg1 - LSL = 300
Cpl = UCpl / tsigma ' get cpl0u
if Cpu > Cpl then Cpk = Cpl ' compare cpu and cpl get the lower value as cpk
if Cpl >= Cpu then Cpk = Cpu

prioravg1=avg1
%>
<tr>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=Pkgid%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(atavg1,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(atdiffavg1,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(UCL,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(LCL,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=count%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(Range1ave,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(Rucl,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(Rlcl,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=Formatnumber(cpk,2)%></font></Td><br>
<Td width="7%" bgcolor="#f1f1f1" align="center"><font face="verdana" size="2"><%=FormatNumber(cp,2)%></font></Td><br>
</tr>
<%
rs.movenext
Loop%>

<tr>
<td colspan="12" align="center" bgcolor="#ffffff"><font face="verdana" size="2"><b>
Plating Thickness SPC Control Chart Limit and CPK Data For <%=Ucase(Pkgid)%> From WW <%=tBegin%> To WW <%=tEnd%>.
</font></b></td></tr>
<%end if
end if%>
</table>

cs168
08-12-2005, 02:10 AM
This method it is only giving me all the recordset on one case, this is not what I want, What I am looking for is how can I repeat all the case in my code? For example
I have case "P" ,case "G" case"208" and others, currently I only can run one case per click, How can I run all the case in one click? It's what I am looking for.

Tks hope you will understand what I need and help on this.

neocool00
08-12-2005, 05:09 PM
First, add the line in blue to your code and remove the line in red:


<select name="pkgtype" id="pkgtype">
<option value="all">Run all packages</option>
<option Value="P">All Pkg
<option value="G"> All Green Pkg
<option Value = "128">PQFP128
<option Value = "208">PQFP208
<option Value = "PK100">PK100
<option Value = "PK128">PK128
<option value="<%=pkgtype%>"Selected</option>
</select>

Secondly, add the line in blue to your select case statement:


select case request ("pkgtype")
case "P"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Not Like '%G%' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "All Sn/Pb Pkg"
case "G"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%G%' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "All Green Pkg"
case "208"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%208' and Pkgtype Not Like '%G208' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "PQFP 208"
case "128"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%128' and Pkgtype Not Like '%G128' and Pkgtype Not Like '%PK128' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "PQFP 128"
case "PK100"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK100' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "PK 100"
case "PK128"
sql="select Avg1, Range1, PkgType from tblFiles where Pkgtype Like '%PK128' and workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "PK 128"
case "all"
sql="select Avg1, Range1, PkgType from tblFiles where workweek between " & tBegin & " and " & tEnd & " and Year = " & tYear & " Order by workweek DESC"
Pkgid= "All Packages"
End select

cs168
08-13-2005, 03:38 AM
Hi, tks for helping, as what you show me I only can get one result base on all the data in my db, what I want is to have all type of data to be show in one table, for example, I have cat,dag & mouse in my db I want,
cat data
dog data
mouse data
& all data
in one table...

neocool00
08-15-2005, 04:03 PM
If you've made the changes I have suggested, it should work. Could you repost your code again so that I can see it with the changes?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum