Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generate Querystring Item From Array

Status
Not open for further replies.

LongFeiFengWu

Technical User
Nov 9, 2001
98
US
Here is the script I'm working with:

FName = request.querystring("FName")
LName = request.querystring("LName")

YEAR1 = Year(Now())

SQL = "SELECT * "
SQL = SQL & "FROM SCORE WHERE SUPID = '"& request.querystring("SUPID") &"' "
SQL = SQL & "AND YEAR1 = "& YEAR1 &" "

objrec.open SQL,objcon,3,3

Dim months, vars

months = Split("JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC",",")
vars = Split("AHTC,AHTE,AHTO,CPH,ATT,TIPS,OBS,REV,MEET,DEV",",")

FOR v=0 TO ubound(vars)
Execute("Dim " & vars(v))
Execute(vars(v) & "=0")
Execute("Dim " & vars(v) & "_count")
Execute(vars(v) & "_count=0")
Execute("Dim YTD" & vars(v))
Execute("YTD" & vars(v) & "=0")
next

For v=0 to ubound(vars)
For m=0 to ubound(months)
Execute(vars(v) & "=" & vars(v) & " + objrec(""" & months(m) & vars(v) & """)")
Execute("IF objrec(""" & months(m) & vars(v) & """) > 0 THEN " & vars(v) & "_count=" & vars(v) & "_count+1")
next
next

FOR v=0 TO ubound(vars)
Execute("YTD" & vars(v) & " = formatDIV(" & vars(v) & "," & vars(v) & "_count,1)")
next


do while not objrec.eof

Link = "<a href='edit.asp?SUPID="& objrec("SUPID") &"&YEAR1="& objrec("YEAR1") &"'

What I want to do is take the arry and add part of it to the Link = "<a href='edit.asp?SUPID="& objrec("SUPID") &"&YEAR1="& objrec("YEAR1") &"' as &Item= whatever, so that when the link is clicked, it carries the exact MONTH & VARIABLE combination that was clicked.

The array was written by a nice person on this forum for me, so I don't quite understand it well enough yet to do this.

Any help would be greatly appreciated.

&quot;If nothing within you stays rigid, outward things will disclose themselves. Moving, be like water. Still, be like a mirror. Respond like an echo.&quot; ~ Bruce Lee
 
objrec is still a recordset and is being pulled thru the array loops.. so you can use it just as you wrote in the sample above...

dont know what pattern you're trying to use on the link, if you could write out more of a full sample of it to work with i would be happy to oblidge... for "month" and "variable"

[thumbsup2]DreX
aKa - Robert
 
Here is the script down to the first link I'd like to use. Basically, I want to be able to click the link and carry the data for that particular data value over to another page, so that it can be edited using a form on that page. There are so many that I'd like to harness the power of this array to do it instead of writing out 120 IF THEN statements on each page if I can help it.

<%

FName = request.querystring("FName")
LName = request.querystring("LName")

YEAR1 = Year(Now())

SQL = "SELECT * "
SQL = SQL & "FROM SCORE WHERE SUPID = '"& request.querystring("SUPID") &"' "
SQL = SQL & "AND YEAR1 = "& YEAR1 &" "

objrec.open SQL,objcon,3,3

Dim months, vars

months = Split("JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC",",")
vars = Split("AHTC,AHTE,AHTO,CPH,ATT,TIPS,OBS,REV,MEET,DEV",",")

FOR v=0 TO ubound(vars)
Execute("Dim " & vars(v))
Execute(vars(v) & "=0")
Execute("Dim " & vars(v) & "_count")
Execute(vars(v) & "_count=0")
Execute("Dim YTD" & vars(v))
Execute("YTD" & vars(v) & "=0")
next

For v=0 to ubound(vars)
For m=0 to ubound(months)
Execute(vars(v) & "=" & vars(v) & " + objrec(""" & months(m) & vars(v) & """)")
Execute("IF objrec(""" & months(m) & vars(v) & """) > 0 THEN " & vars(v) & "_count=" & vars(v) & "_count+1")
next
next

FOR v=0 TO ubound(vars)
Execute("YTD" & vars(v) & " = formatDIV(" & vars(v) & "," & vars(v) & "_count,1)")
next

do while not objrec.eof

Link = "<a href='edit.asp?SUPID="& objrec("SUPID") &"&YEAR1="& objrec("YEAR1") &"&MONTHS="& months &"&VARS="& vars &"'>"

response.write "<tr>"
response.write "<td width=263 colspan=6 align=center><font color=#FFFFFF face=Book Antiqua><b>"& FName &" "& LName &"</b></font></td>"
response.write "<td width=266 colspan=8 align=center><b><font color=#FFFFFF face=Book Antiqua size=3>eCenter "& Year(Now()) &" Monthly Score Card</font></b></td>"
response.write "<td colspan=3 width=95><p align=center><font color=#FFFFFF><input type=button value=Print This Page name=B1 style=font-family: Book Antiqua; font-size: 10pt; font-weight: bold; background-color: #990033; color: #FFFFFF; border-style: solid; border-color: #990033></font></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><font color=#FFFFFF size=2 face=Arial><b><span style=font-variant: small-caps>item</span></b></font></td>"
response.write "<td width=75 align=center><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>objective</font></span></b></td>"
response.write "<td width=13 align=center colspan=2 bgcolor=#990033>&nbsp;</td>"
response.write "<td width=28><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>jan</font></span></b></td>"
response.write "<td width=25><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>feb</font></span></b></td>"
response.write "<td width=34><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>mar</font></span></b></td>"
response.write "<td width=30><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>apr</font></span></b></td>"
response.write "<td width=30><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>may</font></span></b></td>"
response.write "<td width=28><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>jun</font></span></b></td>"
response.write "<td width=27><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>jul</font></span></b></td>"
response.write "<td width=30><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>aug</font></span></b></td>"
response.write "<td width=29><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>sep</font></span></b></td>"
response.write "<td width=30><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>oct</font></span></b></td>"
response.write "<td width=30><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>nov</font></span></b></td>"
response.write "<td width=29><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>dec</font></span></b></td>"
response.write "<td width=28><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>ytd</font></span></b></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td colspan=17 width=632 bgcolor=#990033><p align=left><b><span style=font-variant: small-caps><font face=Book Antiqua size=3 color=#FFFFFF>efficiency / productivity / cost</font></span></b></p></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>aht - calls</font></span></b></td>"
response.write "<td width=75 align=center colspan=2><b><span style=font-variant: small-caps><font face=Arial size=2 color=#FFFFFF>405</font></span></b></td>"
response.write "<td width=13 align=center bgcolor=#990033 valign=middle>&nbsp;</td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JANAHTC") &"</font></td>"

&quot;If nothing within you stays rigid, outward things will disclose themselves. Moving, be like water. Still, be like a mirror. Respond like an echo.&quot; ~ Bruce Lee
 
Here is all the script for this page; I apologize for its length. The parts in bold are the objrec("month&var") references which are links and are linked to the line in red. Right now, the querystring only carries SUPID and YEAR1. I'd like it to carry the value and label of each item as well. That's the part I don't understand how to do.:

<!--#Include file="../Includes/openDBconnections1.asp" -->
<!--#Include file="../Includes/format.asp" -->
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<style fprolloverstyle>A:hover {color: red; font-weight: bold}
</style>
</head>

<script language="VBScript">

sub B1_onclick()

window.print()

end sub

</script>

<body bgcolor="#000000" link="#C0C0C0" vlink="#C0C0C0">

<form method="POST" action="scoreview.asp" name="theform">

<div align=center>
<center>
<table border="1" cellspacing="0" width="697" bordercolor="#990033">
<%

FName = request.querystring("FName")
LName = request.querystring("LName")

YEAR1 = Year(Now())

SQL = "SELECT * "
SQL = SQL & "FROM SCORE WHERE SUPID = '"& request.querystring("SUPID") &"' "
SQL = SQL & "AND YEAR1 = "& YEAR1 &" "

objrec.open SQL,objcon,3,3

Dim months, vars

months = Split("JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC",",")
vars = Split("AHTC,AHTE,AHTO,CPH,ATT,TIPS,OBS,REV,MEET,DEV",",")

FOR v=0 TO ubound(vars)
Execute("Dim " & vars(v))
Execute("Dim " & vars(v) & "_count")
Execute("Dim YTD" & vars(v))
next

do while not objrec.eof

FOR v=0 TO ubound(vars)
Execute(vars(v) & "=0")
Execute(vars(v) & "_count=0")
Execute("YTD" & vars(v) & "=0")
next

For v=0 to ubound(vars)
For m=0 to ubound(months)
Execute(vars(v) & "=" & vars(v) & " + objrec(""" & months(m) & vars(v) & """)")
Execute("IF objrec(""" & months(m) & vars(v) & """) > 0 THEN " & vars(v) & "_count=" & vars(v) & "_count+1")
next
next

FOR v=0 TO ubound(vars)
Execute("YTD" & vars(v) & " = formatDIV(" & vars(v) & "," & vars(v) & "_count,1)")
next

Link = "<a href='edit.asp?SUPID="& objrec("SUPID") &"&YEAR1="& objrec("YEAR1") &"'>"

response.write "<tr>"
response.write "<td width=263 colspan=6 align=center><font color=#FFFFFF face=Book Antiqua><b>"& FName &" "& LName &"</b></font></td>"
response.write "<td width=266 colspan=8 align=center><b><font color=#FFFFFF face=Book Antiqua size=3>eCenter "& Year(Now()) &" Monthly Score Card</font></b></td>"
response.write "<td colspan=3 width=95><p align=center><font color=#FFFFFF><input type=button value=Print This Page name=B1 style=font-family: Book Antiqua; font-size: 10pt; font-weight: bold; background-color: #990033; color: #FFFFFF; border-style: solid; border-color: #990033></font></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><font color=#FFFFFF size=1 face=Arial><b><span style=font-variant: small-caps>ITEM</span></b></font></td>"
response.write "<td width=75 align=center><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>OBJECTIVE</font></span></b></td>"
response.write "<td width=13 align=center colspan=2 bgcolor=#990033>&nbsp;</td>"
response.write "<td width=28><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>JAN</font></span></b></td>"
response.write "<td width=25><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>FEB</font></span></b></td>"
response.write "<td width=34><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>MAR</font></span></b></td>"
response.write "<td width=30><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>APR</font></span></b></td>"
response.write "<td width=30><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>MAY</font></span></b></td>"
response.write "<td width=28><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>JUN</font></span></b></td>"
response.write "<td width=27><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>JUL</font></span></b></td>"
response.write "<td width=30><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>AUG</font></span></b></td>"
response.write "<td width=29><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>SEP</font></span></b></td>"
response.write "<td width=30><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>OCT</font></span></b></td>"
response.write "<td width=30><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>NOV</font></span></b></td>"
response.write "<td width=29><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>DEC</font></span></b></td>"
response.write "<td width=28><b><span style=font-variant: small-caps><font face=Book Antiqua size=1 color=#FFFFFF>YTD</font></span></b></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td colspan=17 width=632 bgcolor=#990033><p align=left><b><span style=font-variant: small-caps><font face=Book Antiqua size=2 color=#FFFFFF>EFFICIENCY / PRODUCTIVITY / COST</font></span></b></p></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>AHT - CALLS</font></span></b></td>"
response.write "<td width=75 align=center colspan=2><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>405</font></span></b></td>"
response.write "<td width=13 align=center bgcolor=#990033 valign=middle>&nbsp;</td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JANAHTC") &"</font></td>"
response.write "<td width=25 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("FEBAHTC") &"</font></td>"
response.write "<td width=34 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MARAHTC") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("APRAHTC") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MAYAHTC") &"</font></td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JUNAHTC") &"</font></td>"
response.write "<td width=27 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JULAHTC") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("AUGAHTC") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("SEPAHTC") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("OCTAHTC") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("NOVAHTC") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("DECAHTC") &"</font></td>"

response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& YTDAHTC &"</font></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>AHT - EMAILS</font></span></b></td>"
response.write "<td width=75 align=center colspan=2><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>470</font></span></b></td>"
response.write "<td width=13 align=center bgcolor=#990033 valign=middle>&nbsp;</td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JANAHTE") &"</font></td>"
response.write "<td width=25 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("FEBAHTE") &"</font></td>"
response.write "<td width=34 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MARAHTE") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("APRAHTE") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MAYAHTE") &"</font></td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JUNAHTE") &"</font></td>"
response.write "<td width=27 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JULAHTE") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("AUGAHTE") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("SEPAHTE") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("OCTAHTE") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("NOVAHTE") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("DECAHTE") &"</font></td>"

response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& YTDAHTE &"</font></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>AHT - ORDERS</font></span></b></td>"
response.write "<td width=75 align=center colspan=2><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>470</font></span></b></td>"
response.write "<td width=13 align=center bgcolor=#990033 valign=middle>&nbsp;</td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JANAHTO") &"</font></td>"
response.write "<td width=25 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("FEBAHTO") &"</font></td>"
response.write "<td width=34 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MARAHTO") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("APRAHTO") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MAYAHTO") &"</font></td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JUNAHTO") &"</font></td>"
response.write "<td width=27 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JULAHTO") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("AUGAHTO") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("SEPAHTO") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("OCTAHTO") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("NOVAHTO") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("DECAHTO") &"</font></td>"

response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& YTDAHTO &"</font></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>CPH</font></span></b></td>"
response.write "<td width=75 align=center colspan=2><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>7.8</font></span></b></td>"
response.write "<td width=13 align=center bgcolor=#990033 valign=middle>&nbsp;</td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JANCPH") &"</font></td>"
response.write "<td width=25 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("FEBCPH") &"</font></td>"
response.write "<td width=34 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MARCPH") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("APRCPH") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MAYCPH") &"</font></td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JUNCPH") &"</font></td>"
response.write "<td width=27 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JULCPH") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("AUGCPH") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("SEPCPH") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("OCTCPH") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("NOVCPH") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("DECCPH") &"</font></td>"

response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& YTDCPH &"</font></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>TEAM ATTENDANCE</font></span></b></td>"
response.write "<td width=75 align=center colspan=2><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>94.5%</font></span></b></td>"
response.write "<td width=13 align=center bgcolor=#990033 valign=middle>&nbsp;</td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JANATT") &"%</font></td>"
response.write "<td width=25 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("FEBATT") &"%</font></td>"
response.write "<td width=34 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MARATT") &"%</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("APRATT") &"%</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MAYATT") &"%</font></td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JUNATT") &"%</font></td>"
response.write "<td width=27 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JULATT") &"%</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("AUGATT") &"%</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("SEPATT") &"%</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("OCTATT") &"%</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("NOVATT") &"%</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("DECATT") &"%</font></td>"

response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& YTDATT &"%</font></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>TIPS</font></span></b></td>"
response.write "<td width=75 align=center colspan=2><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>80%</font></span></b></td>"
response.write "<td width=13 align=center bgcolor=#990033 valign=middle>&nbsp;</td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JANTIPS") &"%</font></td>"
response.write "<td width=25 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("FEBTIPS") &"%</font></td>"
response.write "<td width=34 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MARTIPS") &"%</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("APRTIPS") &"%</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MAYTIPS") &"%</font></td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JUNTIPS") &"%</font></td>"
response.write "<td width=27 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JULTIPS") &"%</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("AUGTIPS") &"%</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("SEPTIPS") &"%</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("OCTTIPS") &"%</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("NOVTIPS") &"%</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("DECTIPS") &"%</font></td>"

response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& YTDTIPS &"%</font></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td colspan=17 width=632 bgcolor=#990033><p align=left><b><span style=font-variant: small-caps><font face=Book Antiqua size=2 color=#FFFFFF>DEVELOPMENT</font></span></b></p></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>OBSERVATIONS / 1 ON 1</font></span></b></td>"
response.write "<td width=75 align=center colspan=2><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>10 TOUCHES PER ASSOCIATE</font></span></b></td>"
response.write "<td width=13 align=center bgcolor=#990033 valign=middle>&nbsp;</td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JANOBS") &"</font></td>"
response.write "<td width=25 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("FEBOBS") &"</font></td>"
response.write "<td width=34 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MAROBS") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("APROBS") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MAYOBS") &"</font></td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JUNOBS") &"</font></td>"
response.write "<td width=27 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JULOBS") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("AUGOBS") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("SEPOBS") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("OCTOBS") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("NOVOBS") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("DECOBS") &"</font></td>"

response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& YTDOBS &"</font></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>PERFORMANCE REVIEWS</font></span></b></td>"
response.write "<td width=75 align=center colspan=2><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>1 PER ASSOCIATE</font></span></b></td>"
response.write "<td width=13 align=center bgcolor=#990033 valign=middle>&nbsp;</td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JANREV") &"</font></td>"
response.write "<td width=25 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("FEBREV") &"</font></td>"
response.write "<td width=34 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MARREV") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("APRREV") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MAYREV") &"</font></td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JUNREV") &"</font></td>"
response.write "<td width=27 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JULREV") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("AUGREV") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("SEPREV") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("OCTREV") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("NOVREV") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("DECREV") &"</font></td>"

response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& YTDREV &"</font></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>TEAM MEETINGS</font></span></b></td>"
response.write "<td width=75 align=center colspan=2><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>1</font></span></b></td>"
response.write "<td width=13 align=center bgcolor=#990033 valign=middle>&nbsp;</td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JANMEET") &"</font></td>"
response.write "<td width=25 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("FEBMEET") &"</font></td>"
response.write "<td width=34 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MARMEET") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("APRMEET") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MAYMEET") &"</font></td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JUNMEET") &"</font></td>"
response.write "<td width=27 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JULMEET") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("AUGMEET") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("SEPMEET") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("OCTMEET") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("NOVMEET") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("DECMEET") &"</font></td>"

response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& YTDMEET &"</font></td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td width=165 align=center><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>DEVELOPMENT POINTS</font></span></b></td>"
response.write "<td width=75 align=center colspan=2><b><span style=font-variant: small-caps><font face=Arial size=1 color=#FFFFFF>100</font></span></b></td>"
response.write "<td width=13 align=center bgcolor=#990033 valign=middle>&nbsp;</td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JANDEV") &"</font></td>"
response.write "<td width=25 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("FEBDEV") &"</font></td>"
response.write "<td width=34 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MARDEV") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("APRDEV") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("MAYDEV") &"</font></td>"
response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JUNDEV") &"</font></td>"
response.write "<td width=27 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("JULDEV") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("AUGDEV") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("SEPDEV") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("OCTDEV") &"</font></td>"
response.write "<td width=30 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("NOVDEV") &"</font></td>"
response.write "<td width=29 align=center valign=middle><font color=#FFFFFF>"& LINK & objrec("DECDEV") &"</font></td>"

response.write "<td width=28 align=center valign=middle><font color=#FFFFFF>"& YTDDEV &"</font></td>"
response.write "</tr>"

objrec.movenext

loop

%>
</table>
</center>
</div>

</form>

</body>

</html>


&quot;If nothing within you stays rigid, outward things will disclose themselves. Moving, be like water. Still, be like a mirror. Respond like an echo.&quot; ~ Bruce Lee
 
egads, but gets the point across, the same thing that was done before to the code to make it into a self handling set of loops based on the arrays can be re-applied here. shortening the source of your page dramatically, and saving you having to copy /paste /edit over and over again to achieve a small repeatitive task. currently buried a little bit in a project at the moment, should be able to get you a tested output here in a few hours. (6pm cst now)


[thumbsup2]DreX
aKa - Robert
 
Thank you very much for all of your help!

&quot;If nothing within you stays rigid, outward things will disclose themselves. Moving, be like water. Still, be like a mirror. Respond like an echo.&quot; ~ Bruce Lee
 
you know you can use asp like regular html and you need not have to response.write the ENTIRE page ... just a lil tidbit of info is all, and there's ALOT going on in all those response.writes, and is even confusing me, all that code can be pretty much shoved into less than 10 lines of loop, because you're doing the same thing over and over again.

if anything it would drastically help to see what you're trying to accomplish, is this page available online somewhere? perhaps dupe it to a temporary location until completed?



[thumbsup2]DreX
aKa - Robert
 
I've placed a shell of this on my personal web hosting server. You can check it out at .

The real one is on an intranet site and you wouldn't be able to see it unless you had access to my company's network.

&quot;If nothing within you stays rigid, outward things will disclose themselves. Moving, be like water. Still, be like a mirror. Respond like an echo.&quot; ~ Bruce Lee
 
thanks, that will help quite a lot, i'll get to working on some code here for you in the next few hours.

[thumbsup2]DreX
aKa - Robert
 
You must drink a lot of coffee.
smiletiniest.gif


&quot;If nothing within you stays rigid, outward things will disclose themselves. Moving, be like water. Still, be like a mirror. Respond like an echo.&quot; ~ Bruce Lee
 
nah.. mountain dew [lol]

bu no i work nights, so i occationally will post in the day, and tend to do everything else night time

will be posting soon... and try to get all of the layout and so forth in the source sample.



[thumbsup2]DreX
aKa - Robert
 
you dont happen to have a generated list of group headers/item headers somewhere? or is it static?

referring to as group headers : DEVELOPMENT,EFFICIENCY / PRODUCTIVITY / COST

and referring to as item headers : AHT - CALLS,AHT - EMAILS,AHT - ORDERS,CPH,TEAM ATTENDANCE,TIPS,OBSERVATIONS / 1 ON 1,PERFORMANCE REVIEWS,TEAM MEETINGS,DEVELOPMENT POINTS

[thumbsup2]DreX
aKa - Robert
 
it's all static. i'm really new to this stuff, so i do it all the hard way. a lot of easy to manage small parts. probably way more work than necessary.

&quot;If nothing within you stays rigid, outward things will disclose themselves. Moving, be like water. Still, be like a mirror. Respond like an echo.&quot; ~ Bruce Lee
 
in the sample page is that all the items you're planning on having ?

[thumbsup2]DreX
aKa - Robert
 
Thats some interesting code. What are the chances you could do a re-design on the database? Is this being filled by another application or does it exist purely for this one? I see several places that imply some of the structure of your table and from what I can see you would gain quite a bit of efficiency and simplicity from a minor rewrite.

Right now it looks like you have columns set up for SUPID, Year1, 120 fields for item vs month, and possibly more that you aren't accesssing from this page. This could easily be split into three tables (Score, Month, Item) or even Two( Score, Item) with Month and VarItem being lookup tables. This would not only make your database smaller (instead of storing a whole lot of empty fields, etc) it will decrease transmision time between your database and web server, allow you to increase the efficiency of your script by quite a bit (right now your executing 160 Executes per record found in the database, we could cut that to 0), and allow you to simplify a good deal of your code for later maintainability (like if you get hit by a bus :p ). With the changes you also wouldn't have to rewrite your code if they suddenly came up with some magic new Item they wanted added, in fact itshould take all of 30 seconds to add it with a better db design. Th code should just adapt without changes.

Ideally I would think you would want a setup like this:
Score
score_id- autonumber or seeded integer
SUPID - text? dunno what this field stands for
Score - number (dunno what kind, probably integer)
aDate - short date
item_id - integer (long)

Item
item_id - autonumber or seeded integer
item_short - text field or varcar, 4 character length
item_long - text field or varchar, 25 character length
objective - text value to cover all types

If there are necesary fields that I haven't included I could add them fairly easily for you, just mention it.

Now to start a display page we could use SUM functions in our SQL statement, group by the month and we could use COUNT to get the counts. This takes some of the burden off our script and reduces the amount of memory we will need for the ASP script. We would also want to order it by the Date field and the Item field to get groups of records with the same item in order by month (ORDER BY item_id, aDate).

So lets throw together some sample code real quick:
Code:
<%
Option Explicit
%>
<!--#Include file="../Includes/openDBconnections1.asp" -->
<!--#Include file="../Includes/format.asp" -->

<!-- All the top html -->
<%

FName = request.querystring("FName")
LName = request.querystring("LName")

YEAR1 = Year(Now())

SQL = "SELECT Score.SUPID, SUM(Score.Score) as ScoreTotal, SUM(Score.Score) as ScoreCount, Month(Score.aDate) as aMonth, Item.item_id, Item.item_short, Item.item_long, Item.objective "
SQL = SQL & "FROM (Score INNER JOIN Item ON Score.item_id = Item.item_id) "
SQL = SQL & "WHERE SUPID = '"& request.querystring("SUPID") &"' "
SQL = SQL & "AND YEAR(aDate) = "& YEAR1 & " "
SQL = SQL & "GROUP BY Score.SUPID, Month(Score.aDate) as aMonth, Item.item_id, Item.item_short, Item.item_long, Item.objective "
SQL = SQL & "ORDER BY Item, Month(aDate)"

objrec.open SQL,objcon,3,3

Dim aMonth, anItem, yearTotal
Dim t_ctr

'--- Output stuff to start the table
Response.Write "<table><tr><th colspan=""5"">Representative Name Here</th>...etc </tr>"
Response.Write "<tr><td>Item</td><td>Objective</td><td>Pretty Color Cell</td>"
For t_ctr = 1 to 12
   Response.Write "<td>" & Left(MonthName(t_ctr),3) & "</td>"
Next
Response.Write "</tr>"

'--- Loop to output data
If Not objrec.EOF Then objRec.MoveFirst
Do Until objRec.EOF
   'if first row or item dosn't match item from last loop, start a new row
   If anItem <> objRec("item_id") Then
      'if there is something in anItem, end the previous row by looping through remaining months
	  If len(anItem) > 0 Then
         For t_ctr = aMonth to 12
            Response.Write "<td>&nbsp;</td>"
		 Next
		 
		 'output the yearly total from the yearTotal variable
		 Response.Write "<td>" & yearTotal & "</td>"

		 'end the row
		 Response.Write "</tr>"
      End If

	  'start a row for the new item
	  Response.Write "<tr><td>" & objRec("item_long") & "</td><td>" & objRec("objective") & "</td><td>pretty column here</td>"
	
      'reset the month counter
	  aMonth = 1
   End If

   'if the month for the current record matches our month counter, display it and add to total
   If objRec("aMonth") = aMonth Then
      Response.Write "<td>" & objRec("ScoreTotal") & "</td>"
      yearTotal = yearTotal + objRec("ScoreTotal") & "</td>"

      'increment the recordset
      objRec.MoveNext
   Else
      'otherwise output an empty square
	  Response.Write "<td>&nbsp;</td>"
   End If

   'increment month
   aMonth = aMonth + 1
Loop

'--- output more pretty html to end the table and page
Response.Write "</table></body></html>"
%>

One thing this doesn't cover is the percentages for a couple of your fields. My advice on that would be to add a field to the Item table called ItemType and have a way to define sum vs percentage. The in your code add a second year variable called yearTotalCount. Set it to 0 where yearTotal is set to 0, then replace the current record output if statement with three cases instead of just two. The first case is were the months are equivalent and the type is sum, the second is months equivalent and percentage, the third is the blank cell. Unfortunatly I can't show an example for this because I don't know how your obtaining your percentage. The only other change would be tat where your outputting the yearTotal you would first check if yearTotalCount > 0, if so assume you want a percentage and calculate the years percentage, otherwise output just the yearTotal.

There are a couple fields in my select statement that aren't being used and I also did not output links. The links can be built pretty much the same by including the item_id and aMonth values. You could then output all inputs for that item and month combination as well as a blank entry so that they could edit existing entries forthat month or add another. It ends up a little more complicated but you also have finer control over the data that way.

The only other factor mising here is the pretty sction headings. My advice on that matter is to create a section table with section_id and section_text. Add the section id to the Item table, alter the SQl statement to inner join ith the section table on section_id's, add it as the first field in the ORDER BY, then in the item change section of the main loop after you end a row see if the section has changed (keep it in a variable like anItem), if it has changed output a pretty row with the section name.


I know this seems like a lot of work on something you have almost completed, but if nothing else relies on your current database design I would at least consider it. The efficiency, maintainability, and useability will all increase dramatically with this redesign. If you have any questions, feel free to ask, and even if this dosn't help during your current proect hopefully it will help in future projects,

-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
did you ever get this resolved?

[thumbsup2]DreX
aKa - Robert
 
sure did. the page is all done. thanks for all of your help!

&quot;If nothing within you stays rigid, outward things will disclose themselves. Moving, be like water. Still, be like a mirror. Respond like an echo.&quot; ~ Bruce Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top