I wanted to know if someone could help me with this issue. My current records listing works great, BUT, since the page and categories changes so much, I wanted to know if there is another way to list my records dynamically. I dont want to have static categories, since they change many times and more get added, and would like as little maintenance as possible in this page, since it will be the main Time Tracking Page for the entire Department. I am building quite a few of them, but just need a little help to get me started. I tried Arrays and other codes that I have found here, asked many others and still no luck yet.
Any help, I mean any help I would greatly appreciate.
Here is what I have and works:
There is one main page where the records get listed from and the actual names of the categories and user and departments comes from other tables as IDs. So the main table has just numbers.
SQL Query:
<!--#include file="../../../Connections/Daily.asp" -->
<!-- #include file="../../../Connections/adovbs.inc" -->
<%
UserID = TRIM( Request.QueryString( "UserID"
)
WkID = TRIM( Request.QueryString( "WkID"
)
Set RS = Server.CreateObject("ADODB.Recordset"
SqlString = "SELECT Main.Site, Main.Technician, Main.TSpent, Main.Category, Main.Date1, Main.Department, Main.DeptWork, Main.Week, Department.Department as Department_Name, Technicians.Technician as Tech_Name, Category.Category as Category_Name "
SqlString = SqlString & " FROM ((((Main INNER JOIN Technicians ON Main.Technician = Technicians.TechID) INNER JOIN Site ON Main.Site = Site.SiteID) INNER JOIN Department ON Main.Department = Department.DeptID) INNER JOIN Category ON Main.Category = Category.CatID) INNER JOIN Week ON Main.Week = Week.WeekID"
SqlString = SqlString & " WHERE Technicians.TechID = " & UserID & " and Week.WeekID = " & WkID
SqlString = SqlString & " Order by Category.CatID, Main.Category "
SET RS = objConn.Execute( sqlString )
%>
The Cases:
<%
Dim Category1, Category2, Category3, Category4, Category5, Category6, Category7, Category8, Category9, Category10, Category11
Dim Category12, Category13, Category14, Category15, Category16, Category17, Category18, Category19, Category20, Total
Category1 = 0
Category2 = 0
Category3 = 0
Category4 = 0
Category5 = 0
Category6 = 0
Category7 = 0
Category8 = 0
Category9 = 0
Category10 = 0
Category11 = 0
Category12 = 0
Category13 = 0
Category14 = 0
Category15 = 0
Category16 = 0
Category17 = 0
Category18 = 0
Category19 = 0
Category20 = 0
Total = 0
while not RS.EOF
Cat_Name = RS("Category_Name"
Cat = RS("Category"
Spent = RS("TSpent"
Tech = RS("Tech_Name"
Select Case Cat
'Select Category
Case "1"
Category1 = Spent /60 + Category1
Case "2"
Category2 = Spent /60 + Category2
Case "3"
Category3 = Spent /60 + Category3
Case "4"
Category4 = Spent /60 + Category4
Case "5"
Category5 = Spent /60 + Category5
Case "6"
Category6 = Spent /60 + Category6
Case "7"
Category7 = Spent /60 + Category7
Case "8"
Category8 = Spent /60 + Category8
Case "9"
Category9 = Spent /60 + Category9
Case "10"
Category10 = Spent /60 + Category10
Case "11"
Category11 = Spent /60 + Category11
Case "12"
Category12 = Spent /60 + Category12
Case "13"
Category13 = Spent /60 + Category13
Case "14"
Category14 = Spent /60 + Category14
Case "15"
Category15 = Spent /60 + Category15
Case "16"
Category16 = Spent /60 + Category16
Case "17"
Category17 = Spent /60 + Category17
Case "18"
Category18 = Spent /60 + Category18
Case "19"
Category19 = Spent /60 + Category19
Case "20"
Category20 = Spent /60 + Category20
End select
RS.MoveNext
WEND
Total = Category1 + Category2 + Category3 + Category4 + Category5 + Category6 + Category7 + Category8 + Category9 + Category10 + Category11 + Category12 + Category13 + Category14 + Category15 + Category16 + Category17 + Category18 + Category19 + Category20
%>
The Listing:
<table width="100%" border="1" cellpadding="0" cellspacing="2" bordercolor="#000000" class="Graph">
<!--DWLayoutTable-->
<tr>
<td width="412">Category:</td>
<td width="168"> <div align="right">Moves </div></td>
<td width="398"><div align="right">
<%
If Category1 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category1) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Tickets</div></td>
<td><div align="right">
<%
If Category2 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category2) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td> <div align="right">Internal Project</div></td>
<td><div align="right">
<%
If Category3 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category3) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td> <div align="right">External Project </div></td>
<td><div align="right">
<%
If Category4 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category4) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Image Updates </div></td>
<td><div align="right">
<%
If Category5 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category5) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Web Updates </div></td>
<td><div align="right">
<%
If Category6 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category6) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Email </div></td>
<td><div align="right">
<%
If Category7 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category7) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Lab Work </div></td>
<td><div align="right">
<%
If Category8 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category8) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Web Design </div></td>
<td><div align="right">
<%
If Category9 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category9) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Reports </div></td>
<td><div align="right">
<%
If Category10 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category10) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Misc Work </div></td>
<td><div align="right">
<%
If Category11 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category11) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Research </div></td>
<td><div align="right">
<%
If Category12 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category12) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Clean Up </div></td>
<td><div align="right">
<%
If Category13 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category13) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Design </div></td>
<td><div align="right">
<%
If Category14 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category14) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Data Entry </div></td>
<td><div align="right">
<%
If Category15 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category15) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Collections Efforts</div></td>
<td> <div align="right">
<%
If Category16 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category16) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Collections OT</div></td>
<td> <div align="right">
<%
If Category17 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category17) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Executive Work</div></td>
<td> <div align="right">
<%
If Category18 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category18) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Training</div></td>
<td> <div align="right">
<%
If Category19 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category19) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Administration</div></td>
<td> <div align="right">
<%
If Category20 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category20) & "Hrs"
End If
%>
</div></td>
</tr>
</table>
I have tried several books and forums and online FAQs and yet still no luck. Been trying this for about 2 weeks now and just cant come up with another solution besides Static names and Calculations. PLEASE PLEASE someone give me a hand here. I would really appreciate this.
Again Thank You For Your Time.
Any help, I mean any help I would greatly appreciate.
Here is what I have and works:
There is one main page where the records get listed from and the actual names of the categories and user and departments comes from other tables as IDs. So the main table has just numbers.
SQL Query:
<!--#include file="../../../Connections/Daily.asp" -->
<!-- #include file="../../../Connections/adovbs.inc" -->
<%
UserID = TRIM( Request.QueryString( "UserID"
WkID = TRIM( Request.QueryString( "WkID"
Set RS = Server.CreateObject("ADODB.Recordset"
SqlString = "SELECT Main.Site, Main.Technician, Main.TSpent, Main.Category, Main.Date1, Main.Department, Main.DeptWork, Main.Week, Department.Department as Department_Name, Technicians.Technician as Tech_Name, Category.Category as Category_Name "
SqlString = SqlString & " FROM ((((Main INNER JOIN Technicians ON Main.Technician = Technicians.TechID) INNER JOIN Site ON Main.Site = Site.SiteID) INNER JOIN Department ON Main.Department = Department.DeptID) INNER JOIN Category ON Main.Category = Category.CatID) INNER JOIN Week ON Main.Week = Week.WeekID"
SqlString = SqlString & " WHERE Technicians.TechID = " & UserID & " and Week.WeekID = " & WkID
SqlString = SqlString & " Order by Category.CatID, Main.Category "
SET RS = objConn.Execute( sqlString )
%>
The Cases:
<%
Dim Category1, Category2, Category3, Category4, Category5, Category6, Category7, Category8, Category9, Category10, Category11
Dim Category12, Category13, Category14, Category15, Category16, Category17, Category18, Category19, Category20, Total
Category1 = 0
Category2 = 0
Category3 = 0
Category4 = 0
Category5 = 0
Category6 = 0
Category7 = 0
Category8 = 0
Category9 = 0
Category10 = 0
Category11 = 0
Category12 = 0
Category13 = 0
Category14 = 0
Category15 = 0
Category16 = 0
Category17 = 0
Category18 = 0
Category19 = 0
Category20 = 0
Total = 0
while not RS.EOF
Cat_Name = RS("Category_Name"
Cat = RS("Category"
Spent = RS("TSpent"
Tech = RS("Tech_Name"
Select Case Cat
'Select Category
Case "1"
Category1 = Spent /60 + Category1
Case "2"
Category2 = Spent /60 + Category2
Case "3"
Category3 = Spent /60 + Category3
Case "4"
Category4 = Spent /60 + Category4
Case "5"
Category5 = Spent /60 + Category5
Case "6"
Category6 = Spent /60 + Category6
Case "7"
Category7 = Spent /60 + Category7
Case "8"
Category8 = Spent /60 + Category8
Case "9"
Category9 = Spent /60 + Category9
Case "10"
Category10 = Spent /60 + Category10
Case "11"
Category11 = Spent /60 + Category11
Case "12"
Category12 = Spent /60 + Category12
Case "13"
Category13 = Spent /60 + Category13
Case "14"
Category14 = Spent /60 + Category14
Case "15"
Category15 = Spent /60 + Category15
Case "16"
Category16 = Spent /60 + Category16
Case "17"
Category17 = Spent /60 + Category17
Case "18"
Category18 = Spent /60 + Category18
Case "19"
Category19 = Spent /60 + Category19
Case "20"
Category20 = Spent /60 + Category20
End select
RS.MoveNext
WEND
Total = Category1 + Category2 + Category3 + Category4 + Category5 + Category6 + Category7 + Category8 + Category9 + Category10 + Category11 + Category12 + Category13 + Category14 + Category15 + Category16 + Category17 + Category18 + Category19 + Category20
%>
The Listing:
<table width="100%" border="1" cellpadding="0" cellspacing="2" bordercolor="#000000" class="Graph">
<!--DWLayoutTable-->
<tr>
<td width="412">Category:</td>
<td width="168"> <div align="right">Moves </div></td>
<td width="398"><div align="right">
<%
If Category1 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category1) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Tickets</div></td>
<td><div align="right">
<%
If Category2 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category2) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td> <div align="right">Internal Project</div></td>
<td><div align="right">
<%
If Category3 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category3) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td> <div align="right">External Project </div></td>
<td><div align="right">
<%
If Category4 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category4) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Image Updates </div></td>
<td><div align="right">
<%
If Category5 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category5) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Web Updates </div></td>
<td><div align="right">
<%
If Category6 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category6) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Email </div></td>
<td><div align="right">
<%
If Category7 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category7) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Lab Work </div></td>
<td><div align="right">
<%
If Category8 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category8) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Web Design </div></td>
<td><div align="right">
<%
If Category9 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category9) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Reports </div></td>
<td><div align="right">
<%
If Category10 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category10) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Misc Work </div></td>
<td><div align="right">
<%
If Category11 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category11) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Research </div></td>
<td><div align="right">
<%
If Category12 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category12) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Clean Up </div></td>
<td><div align="right">
<%
If Category13 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category13) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Design </div></td>
<td><div align="right">
<%
If Category14 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category14) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Data Entry </div></td>
<td><div align="right">
<%
If Category15 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category15) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Collections Efforts</div></td>
<td> <div align="right">
<%
If Category16 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category16) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Collections OT</div></td>
<td> <div align="right">
<%
If Category17 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category17) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Executive Work</div></td>
<td> <div align="right">
<%
If Category18 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category18) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Training</div></td>
<td> <div align="right">
<%
If Category19 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category19) & "Hrs"
End If
%>
</div></td>
</tr>
<tr>
<td>Category:</td>
<td><div align="right">Administration</div></td>
<td> <div align="right">
<%
If Category20 = 0 then
Response.Write ("No Time Recorded"
Else
Response.Write (Category20) & "Hrs"
End If
%>
</div></td>
</tr>
</table>
I have tried several books and forums and online FAQs and yet still no luck. Been trying this for about 2 weeks now and just cant come up with another solution besides Static names and Calculations. PLEASE PLEASE someone give me a hand here. I would really appreciate this.
Again Thank You For Your Time.