 |
In
this design we place Report Section to the content slot. |
 |
In
connection slot place connection component and select AcodbcConnection
from Select Component Dialog
|
 |
In
component properties dialog set datasource to egData.
|
 |
In
DataStream slot place Data filter from the Data palette
|
 |
Select
AcMemoryDataSorter from the list.
|
 |
In
Input place Query component from the palette and double click . In
Component Editor clock on the Ellipse button and give blank username
and password in Database Login.Expand the sfdata tree and drag out the
customers table and drag * to the Columns grid .
|
 |
Add
two TextControls in frame and set ValueExp to address_addrname ,address_addrcity,
address_addrstate.
|
 |
Double
click the AcMemoryDataSorter
and select
Compare( ) function
from the method tab and click Override button
|
 |
Type the remaining lines to the function after 'Compare =
Super::Compare( row1, row2 )
|
|
Dim cust1 as DataRow
Dim cust2 as DataRow
Set cust1=row1
Set cust2=row2
Compare=CompareKeys(cust1.address_addrstate,
cust2.address_addrstate)
If Compare=0 Then
Compare=CompareKeys
(cust1.address_addrcity,cust2.address_addrcity)
End If
End Function
Compare:
This method specifies how the rows should be sorted
In this design we compare the two states
1 A positive number if the first row goes after the second
row.
2 0 if both rows are the same.
3 A negative number if the first row goes before the second
row.
If the states are same then we check corresponding city. The
output will be shown by the alphabetical order.
|

|