[thelist] Data Shaping and Count

Ken Schaefer Ken at adOpenStatic.com
Wed May 11 02:15:23 CDT 2005


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: -----Original Message-----
: From: thelist-bounces at lists.evolt.org [mailto:thelist-
: bounces at lists.evolt.org] On Behalf Of Michele Foster (WizarDev)
: Sent: Wednesday, 11 May 2005 2:18 PM
: To: thelist at lists.evolt.org
: Subject: Re: [thelist] Data Shaping and Count
: 
: 
: ----- Original Message -----
: From: "Matt Warden" <mwarden at gmail.com>
: 
: 
: > Ken,
: >
: > On 5/11/05, Ken Schaefer <Ken at adopenstatic.com> wrote:
: > > Be careful here. Are we talking about VBScript or Jscript? Or
: PerlScript?
: > > Etc.
: >
: > See her original message. She's clearly using VBScript.
: >
: > But, good thing to keep in mind.
: >
: 
: 
: And it's working!!!  Many thanks to Matt and Joshua for your help.  The
: key
: was to..  after I moved to the next record, check if rs.eof if so, Exit Do
: or Loop.
: 
: Thanks guys, the client is going to be very pleased.  :)
: 
: Mich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Exit <whatever> is usually an indication of an unnecessary bit of code, and I
think it's a bit ugly.

I'm not entirely sure what your loops are all doing, but you can simplify the
loop to read like this:

<%
Dim iJobID    ' Holds titles of jobs (or whatever)

Do While Not objRS.EOF

	' If this is a new record print a header
	If iJobID <> objRS("jobID") then
	
		iJobID = objRS("jobID") ' Store new ID
		Response.Write("New record with ID: " & iJobID & "<br />")

	End If
	
	' Regardless of whether this is a new record or not
	' we print the current record's details
	Response.Write("This record:" & objRS("RecordID") & "<br />")
	objRS.Movenext

Loop
%>

I think the code is a bit simpler than what you have at the moment.

Cheers
Ken

--
www.adOpenStatic.com/cs/blogs/ken/ 




More information about the thelist mailing list