Hi CroCrew et. All,
I am currently working on a quick report that count a total of completed records per Individual. The code that I have will add up all Individual completed records and what I want is to get a total for each of the Individuals per month. For example,
CroCrew
....
....
Total = 2
Jim
....
....
Total = 2
Below is part of the show completed records that I used and wonder if you can help. This is my first time to try to put the code into the format that you and HOPE YOU IT WILL SHOW UP RIGHT. Thanks once again for your help. -
-
<TR BGCOLOR="CEEFFF">
-
<TD> <DIV ALIGN="CENTER">RECORD</DIV></TD>
-
<TD> <DIV ALIGN="CENTER"><STRONG>INDIVIDUAL</STRONG></DIV></TD>
-
<TD> <DIV ALIGN="CENTER"><STRONG>COMPLETE DATE</STRONG></DIV></TD>
-
</TR>
-
-
-
<%
-
-
WHILE NOT RS.EOF
-
-
Response.Write("<TR>")
-
Response.Write("<TD>" & RS("RecordID") & " </TD>")
-
Response.Write("<TD>" & RS("Individual") & " </TD>")
-
Response.Write("<TD>" & RS("CompleteDate") & " </TD>")
-
-
-
Response.Write("</TR>")
-
-
strCount=strCount + 1
-
-
RS.MoveNext
-
Wend
-
-
RS.Close
-
Conn.Close
-
set Conn = nothing
-
set RS = Nothing
-
-
Response.Write("<FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">Total Records: ")
-
Response.Write("</FONT>")
-
Response.Write("<FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#FF0000"" SIZE=""2"">")
-
Response.Write(strCount)
-
-
%>
-
-
Feb 26 '08
19 3126
Thanks for your outstanding support and let me know if you have any luck or not.
Meanwhile, Dr B and CroCrew, any comments? Thanks.
Hi Hotflash,
Sorry for the late reply - I've been on holiday - hopefully you've got it working by now but if not....
Do you mean you want to use a different column in your count depending on which search type the user selects?
This shouldn't cause you any problems once you get started. Just remember that any columns that you Select alongside your Count need to be included in your Group By clause. For example, in the statement below I've selected Col1 and Col2 so I've had to include them in my Group By: SELECT Col1, Col2, COUNT(Col3) FROM Table1 WHERE Col1 = 'A' GROUP BY Col1, Col2
Keep it simple - build a complete sql statement for each value of sType in your case statement. You can start to make it more efficient once you've got it working.
Looking at your code I can't see you attempting to implement this anywhere - give it a try yourself then come back to us if you have any problems.
Let us know how you get on,
Dr B
Hi Dr B (The Expert),
Thanks for your replying and hope you had a good holiday. I have been extremely busy on my daily projects as well. This is something very new to me and just want to do it for experience. Hope you can help me know. I know you can because you are the EXPERT on this stuff. Just want to make sure we are on the same sheet of music here.
Let's say there are 3 people in the team: myself (hotflash), dr b and jha. Each of us here completed 2 projects such as "server install" (this is a type of project or Project Type as listed in the case statement). The current working code, if you select By Project Type, type in "Server Install" in the search box and put in the From and To Dates, it will display the following and it is sorted by Individual. Individual Project Type
Hotflash Server Install
Hotflash Server Install
Dr B Server Install
Dr B Server Install
Jha Server Install
Jha Server Install
Total Records: 6
Again, the code that I provided you WORK as listed above! What I want but not knowing what to do is: Individual Project Type
Hotflash Server Install
Hotflash Server Install
Total Records: 2
Dr B Server Install
Dr B Server Install
Total Records: 2
Jha Server Install
Jha Server Install
Total Records: 2
Grand Total: 6
I have sent Jha the codes for him to look over as well. I think it will be easy for me to send you the codes so you can see the output. I can't seem to integrate what you provided that's why I replied to this forum again to make sure I am not confusing you. As always, you are the best of all best and thanks for your outstanding support.
Hi hotflash, have you got this sorted out yet? If not let me know and I'll take a look at it for you.
Dr B
Hi Dr. B,
Haven't tried again lately. Honestly, I am new to the ASP world and this portion is way over my head and would appreciate if you can take a look for me. Please let me know if you can help. Thanks once again for your outstanding support.
-
<%
-
strSearchType = trim(Request("SearchType"))
-
strFDates = trim(Request("FDates"))
-
strTDates = trim(Request("TDates"))
-
If Not IsNumeric(strSearchType) Then sType = 0 Else sType = CDBL(strSearchType)
-
-
strSearchWith = trim(Request("SearchWith"))
-
sqlSearchWith = "'%" & Replace(strSearchWith,"'","''") & "%'"
-
-
FDate = "NO"
-
TDate = "NO"
-
On Error Resume Next
-
FDate = DateValue( CDate( Request("FDates") ) )
-
TDate = DateValue( CDate( Request("TDates") ) )
-
On Error GoTo 0
-
-
If strFDates = "" OR _
-
strTDates = "" Then
-
Response.Redirect("SearchReports-Test.asp?error=Please+enter+all+the+required+fields+before+searching. Thanks.")
-
-
Else
-
Set Conn = Server.CreateObject("ADODB.Connection")
-
Set RS = Server.CreateObject("ADODB.RecordSet")
-
-
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("Database.mdb") _
-
& "; Jet OLEDB:Database Password=happy"
-
-
select case sType
-
case 0 : where = " WHERE 1=1 "
-
case 1 : where = " WHERE Individual LIKE " & sqlSearchWith
-
case 2 : where = " WHERE ProjectType LIKE " & sqlSearchWith
-
case 3 : where = " WHERE Network LIKE " & sqlSearchWith
-
case 4 : where = " WHERE Region LIKE " & sqlSearchWith
-
case else
-
Response.Redirect ("SearchReports-Test.asp?error=Sorry+...+Please+enter+a+valid+search+type.")
-
end select
-
-
strSQL = "SELECT * FROM TableProjects " & where
-
-
If FDate <> "NO" AND TDate <> "NO" Then
-
strSQL = strSQL & " AND CompleteDate BETWEEN #" & FDate & "# AND #" & TDate & "#"
-
End If
-
-
strSQL = strSQL & " ORDER BY Individual, RecordID"
-
-
RS.Open strSQL, Conn
-
-
If (RS.EOF) Then
-
Response.Redirect ("SearchReports-Test.asp?error=Sorry+...+Report+does+not+exist. +Please+enter+a+valid+search+type.+ Thanks.")
-
End If
-
End If
-
%>
-
-
<HTML>
-
<HEAD>
-
<TITLE>Homepage</TITLE>
-
-
-
</HEAD>
-
-
<BODY ONLOAD="jsClock()" BGCOLOR="#FFFFFF">
-
-
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
-
-
<DIV ALIGN="LEFT">
-
-
<TABLE WIDTH="100%"BORDER="1" CELLSPACING="0" CELLPADDING="1">
-
<TR BGCOLOR="CEEFFF">
-
<TD WIDTH="5%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>RECORD ID</STRONG></DIV></FONT></TD>
-
<TD WIDTH="15%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>INDIVIDUAL</STRONG></DIV></FONT></TD>
-
<TD WIDTH="8%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>COMPLETE DATE</STRONG></DIV></FONT></TD>
-
<TD WIDTH="15%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>NETWORK</STRONG></DIV></FONT></TD>
-
<TD WIDTH="25%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>PROJECT TYPE</STRONG></DIV></FONT></TD>
-
<TD WIDTH="25%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>REGION</STRONG></DIV></FONT></TD>
-
</TR>
-
-
<CENTER>
-
<%
- Dim count As Int
-
Dim curr, prev As String
-
-
strCount = 0
-
prev = ""
-
-
WHILE NOT RS.EOF
-
- curr = RS("Individual")
-
If curr = prev Then
-
count = count + 1
-
Else
-
count = 1
-
End If
-
-
Response.Write("<TR>")
-
Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("RecordID") & " </FONT></TD>")
-
Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("Individual") & " </FONT></TD>")
-
Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("CompleteDate") & " </FONT></TD>")
-
Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("Network") & " </FONT></TD>")
-
Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("ProjectType") & " </FONT></TD>")
-
Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("Region") & " </FONT></TD>")
-
-
Response.Write("</TR>")
-
-
strCount=strCount + 1
-
- If prev <> "" And curr <> prev Then
-
Response.Write("<TR>")
-
Response.Write("<TD COLSPAN=6><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & count & " </FONT></TD>")
-
Response.Write("</TR>")
-
End If
-
prev = curr
-
-
RS.MoveNext
-
Wend
-
-
RS.Close
-
Conn.Close
-
set Conn = nothing
-
set RS = Nothing
-
%>
-
</CENTER>
-
</TABLE>
-
<BR>
-
<%
-
Response.Write("<FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">Total Records: ")
-
Response.Write("</FONT>")
-
Response.Write("<FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#FF0000"" SIZE=""2"">")
-
Response.Write(strCount)
-
Response.Write("</FONT>")
-
%>
-
</DIV>
-
-
</BODY>
-
</HTML>
-
I am not sure if it will work cause I've not tested it, but you may try the code (in bold text) I inserted in your quoted code above. Let me know what would happen. Good luck..
Hi deric,
Thanks for your help. It looks like we are getting close now. This is the output that I got when I ran it. 3 issues. Thanks once again for your outstanding support.
1. The total is ALWAYS 1 instead of 2 because let's say Hotflash completes 2
records, etc.
2. For some reason the user keeps jumping around like Dr B jumps up to
Hotflash, Jha jumps up to Dr B.
3. I redefined Dim Int count
Dim String curr, prev
Got "Expected end of statement" errors by using Dim count As Int
Dim curr, prev As String Individual Project Type
Hotflash Server Install
Dr B Server Install
1
Dr B Server Install
Jha Server Install
1
Jha Server Install
Jha Server Install
1
Grand Total: 6
- prev = ""
-
count = 0
-
-
WHILE NOT RS.EOF
-
- curr = RS("Individual")
-
If prev <> "" And curr <> prev Then
-
Response.Write("<TR><TD COLSPAN=6><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & count & " </FONT></TD></TR>")
-
End If
-
-
If curr = prev Then
-
count = count + 1
-
Else
-
count = 1
-
End If
-
-
Response.Write("<TR>")
-
Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("RecordID") & " </FONT></TD>")
-
Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("Individual") & " </FONT></TD>")
-
Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("CompleteDate") & " </FONT></TD>")
-
Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("Network") & " </FONT></TD>")
-
Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("ProjectType") & " </FONT></TD>")
-
Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("Region") & " </FONT></TD>")
-
Response.Write("</TR>")
-
-
strCount=strCount + 1
-
-
RS.MoveNext
-
- prev = curr
-
-
If RS.EOF Then
-
Response.Write("<TR><TD COLSPAN=6><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & count & " </FONT></TD></TR>")
-
End If
-
-
Wend
-
Hi hotflash
Did you try to debug it?
Yeah, I did not guarantee that it will work as expected but the idea was already there, we just have to work around it. :-)
I made a modification on the code (in bold text above), I hope it will help you this time around. ;-) Again, I have not tested it but I have simulated it on a paper just once cause I didn't have enough time.
Regarding the issue (3).. What are you using to execute the program? Try not declaring the variables instead, as you have done with your strCount.
Hi deric,
You are truly another HERO of this ASP forum. Everything works perfectly.
Thanks once again for your OUTSTANDING SUPPORT.
Hi deric,
You are truly another HERO of this ASP forum. Everything works perfectly.
Thanks once again for your OUTSTANDING SUPPORT.
Glad it helped you out....
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Hari Om |
last post by:
Here are the details of my error log files:
I execute the command and get following message at console:
----------------------------------------------------------------------
../sqlldr scott/tiger@common control=/full_path/test.ctl
log=/full_path/adhoc/test.log
SQL*Loader: Release 9.2.0.1.0 - Production on Tue Sep 2 10:49:27 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
|
by: Henry Stockbridge |
last post by:
Hi,
I am doing database documentation and run the procedure below to list
the record count for each table in the database. The results in the
immediate window only a partial listing of tables. It appears the
ones missing are linked (ODBC) tables.
Any help you can lend would be appreciated.
- Henry
|
by: DC Gringo |
last post by:
I have a datagrid control that has paging set up and working. What I would
like is a total record count (not just per page) in the header or near the
header of the datagrid.
Here's my code:
<asp:DataGrid
AllowCustomPaging="false"
AllowPaging="true"
AllowSorting="true"
|
by: darrel |
last post by:
I'm trying to whip up a fancy repeater control that will put records into a
two-column table for me.
This is how I envision it working:
itemtemplate
if record count = odd then write out the TR tag
td <record> /td
if record count = even then wrote out the /TR tag
if record count = odd AND it's the last record, write out an empty TD and
|
by: Peter W Johnson |
last post by:
Hi guys,
I have a problem with a datagrid record count. Here is the code:-
<snip>
Public Class frmMerchantDeposit
Inherits System.Windows.Forms.Form
Dim myconnection As New Odbc.OdbcConnection("DSN=database")
| |
by: rsbutterfly16 via AccessMonster.com |
last post by:
hi guys i have form with a listbox . The listbox is coming from a query that
gets all passengers(column 1 in listbox) and destinations(column 3) . so you
have repeting rows of passengers since they could have up to three
destinations. Then the user has to select a row in the list box , double
click even in my listbox i have to sql query to delete the currect item
selected (passenger with destination). this works fine. however i need to put...
|
by: inamul |
last post by:
I want to see how many people have registered from Countries and also want to Sum the total
Table fields
1. Name,
2. Email
3 Country
I use this query to get number of people registered against country
SELECT count(*) as COUNT , country as COUNTRY
|
by: neenaprasad |
last post by:
I have to take values from two tables with single sql statement.
SQl = SELECT MemAccounts.MemberID,COUNT(MemAccounts.MemberID) AS Total, Membership.First_Name, Membership.Last_Name FROM MemAccounts, Membership WHERE MemAccounts.IntroduceeID <> 0 AND Membership.IsAgent = 1 AND MemAccounts.MemberID = Membership.MemberID AND MemAccounts.TransDate BETWEEN '" &x_FromDate& "' AND '" &x_ToDate& "' GROUP BY MemAccounts.MemberID,...
|
by: dmne05974 |
last post by:
As a novice in Access i am currently writing a database to track certain financial information for a non-profit organisation. As part of the funding they have to monitor age ranges and ethnic minority, this is done with 4 yes/no fields controlled on a form with Bi-state check boxes (minor, adult, ethnicminor, ethnicadult).
The database stores many purchase orders for each person as more money is awarded however each person can only be...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |