Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Filtering and Summarizing a recordset using an item in the RS as a filter


Message #1 by "Doug" <drbarker@b...> on Sat, 26 Aug 2000 1:31:28
I am able to query an Access database and display the results on the web 

page. Great!



However, I want to summarize after each DEPARTMENT.



Database is MSAccess 2000, I've already selected all records pertaining to 

the customer, and ordered by department. I just need help summarizing by 

department. This site will have little traffic.



 I found one promising solution  using "data shaping" at  

http://www.asptoday.com/articles/19990901.htm



I want to know if there is an easier solution.  



I was able to summarize using the filter example on page 549 of Beginning 

ASP 3.0, by using the alphabet as a filter.  i think I need to use the 

ObjRecordSet("Department") as a filter....but I can't figure out how to 

loop through the entire recordset using the first 

ObjRecordSet("Department"), and then move to the next 

ObjRecordSet("Department") and looping through again.



Current method is: 



for intLetter = 1 to 26

strChar = Chr(intletter+64)

strCriteria = "Department LIKE '" & strChar & "*'"

objrecordSet.Filter = strCriteria



....and then I response.write the results into a table





However I have more than one department beginning with the same letter so I 

need a better filter.  Obviously DEPARTMENT is an item in my recordset.



Example of Desired results.



Customer:  XYZ

DEPARTMENT: Admin

Date:		Description:		Regular Hours	After Hours

6/30/2000	Large text string		6		8

6/12/200	Another description	5		4

		SUB TOTAL:		11	12



Customer: JQD

DEPARTMENT: Shop

Date:		Description:		Regular Hours	After Hours

6/30/2000	Large text string		16		400

6/12/200		Another description	15		4

		SUB TOTAL:		31		404



Thanks in advance

Doug Barker

dougbarker@h...

www.intecom.net

Message #2 by "Doug" <drbarker@b...> on Sat, 26 Aug 2000 19:35:11
Correction:  My first posting to this forum contained an error.

In the example of results, the customer will always be the same.  It should 

read





Customer:  XYZ

DEPARTMENT: Admin

Date:		Description:		Regular Hours	After Hours

6/30/2000	Large text string		6		8

6/12/200	Another description	        5		4

		                   SUB TOTAL:  11	        12



Customer: XZY

DEPARTMENT: Shop

Date:		Description:		Regular Hours	After Hours

6/30/2000	Large text string		16		400

6/12/200	Another description     	15		4

		                    SUB TOTAL:  31	        404


  Return to Index