|
Spooky's Databases > Advanced > DRW >
Grouping Records
.When the DRW displays
records in a table format, there is no setting that
allows a heading for each "type" of record.
For example, the default
display of data looks like this :
| RecordID |
RecordName |
RecordType |
| 1 |
Apple |
Fruit |
| 2 |
Banana |
Fruit |
| 3 |
Pear |
Fruit |
| 4 |
Leek |
Vegetable |
| 5 |
Beetroot |
Vegetable |
| 6 |
Bean |
Vegetable |
| 7 |
Steak |
Meat |
| 8 |
Pork |
Meat |
If you wish to provide a
heading for each Record type as below, then there is a
simple method of doing so.
| RecordID |
RecordName |
RecordType |
|
Fruit |
| 1 |
Apple |
Fruit |
| 2 |
Banana |
Fruit |
| 3 |
Pear |
Fruit |
|
Vegetable |
| 4 |
Leek |
Vegetable |
| 5 |
Beetroot |
Vegetable |
| 6 |
Bean |
Vegetable |
| Meat |
| 7 |
Steak |
Meat |
| 8 |
Pork |
Meat |
Create your database using the
connection that contains your data.
You'll want to "order" your data by the
column name you wish to group by.
This is done at step 3 of the DRW > more options > Order
Finish creating the DRW with the wizard
as normal using 'table' as the formatting type.
Now, switch to code view
and locate this code (it will differ slightly with each
DRW) :
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="556" --><tr>
<td>
Add the new code in red below (if you
are cutting and pasting, be sure to paste to notepad first as you want
unformatted text)
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="556" --><tr>
<%
DIM GroupName,tmpGroupName
GroupName=FP_FieldVal(fp_rs,"GroupValue")
If GroupName <> tmpGroupName then
tmpGroupName=GroupName
%>
<td colspan=5><%=tmpGroupName%> </td>
</tr>
<tr>
<%end if%>
<td>
Note : "GroupValue" is
YOUR column name and colspan MUST equal the number of
columns of data you are displaying.
|