What you are wanting is called a control break report. It
gets its name form the fact that you use a control filed
to condition your processing. (FWIW I learned this in a DP
concepts course at the local community college.)
Here's what you do:
Determine what fields will be your control breaks from
major to minor.
In your example they would probably be:
Then, sort your data using the control fields, again,
major to minor:
ORDER BY sale, User
Next, declare a variable to hold the value for each
control field from the previous record.
When you process a record, compare the value in the
control field with the value in the field you stored from
the previous record. If they are the same, you process the
record as a normal detail line. If they are different, you
have a control break and you process the record
I hope that starts you down the correct road.
a few months I'm>-----Original Message-----
>I am new to asp/ado (I'll be starting with that line forfrom a recordset in a>sure!) and I need to learn a good way to display dataasp/ado with vbscript.>nice 'report-like' fashion in Internet Explorer usingrecordset in a table>
>Thus far I have just had to display records from amake a page look more>(every row) and that was easy enough but now I need toexample:>like a report. I think it will be easiest to ask this by$75>
>'jsmith', 'October out', 'HP', 'Laserjet', '850', $100
>'jsmith', 'October out', 'HP', 'Deskjet', '700cse',$225>'jsmith', 'October out', 'Epson', 'Photo', '1200',$350>'rlake', 'October out', 'Xerox', 'foofoo', '2112',$75>'rlake', 'October out', 'Sony', 'Trinitron', 'm70',entered as a parameter by>
>The recordset is produced from a particular 'Sale'each record. There>the user (via a form) so the 'Sale' will be the same fordisplaying the>could be 1 or several records with the same 'User'. Justsince I don't need to>recordset straight into a table row for row is no goodusername multiple times. I>display 'October out' every time, or the sameout) would be>would like to group this by 'User'. The 'Sale' (OctoberThen under that each>listed once at the top of the page as a report title.prices (Make, Model,>'User' should be listed once with the items and theiruser section I>Price) listed in line-item fashion. At the bottom of eachprices. That part I'm>would also need to display the total of all the itemlook something like>sure is easy once I know how to lay this out. It shouldway to make this>this:
>HP Laserjet 850 $100
>HP Deskjet 700cse $75
>Epson Photo 1200 $225
>Xerox foofoo 2112 $350
>Sony Trinitron m70 $75
>I am afraid If I start thinking to hard I WILL find 'A'homework first so I>happen but since this is new too me and I usually do mynot, it will>have a good idea of what I'm doing and this time I couldI'm hoping someone>probably be an overly complicated and inefficient way! So>can lead me in the write direction?