Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String sorting within detail dection 1

Status
Not open for further replies.

ind123p

Programmer
Sep 28, 2005
62
I am using CR XI.

I have a report that has a layout like this.
****************************
Customer ID:
Customer Name:

Type Reference LogStatus
Bank Stmt 034-78433 Received
Pension Plan A12030505 Pending
Credit Card 10101023A Received
******************************************

Customer ID and Customer Name are in the Group Customer ID

Everything after that is in detail sections.

The user would like to sort on any of the detail fields.

Say for example the user decides to sort descending on "Type"

The expected output is
Type Reference LogStatus
Pension Plan A12030505 Pending
Credit Card 10101023A Received
Bank Stmt 034-78433 Received

I know I have to use TopN approach. If these were number fields I would have created a forumla @sort and inserted it in detail field and sorted by the number field
In the Sort formula, I would use a - sign for descending sort.

How do I accomplish the string sorting within the detail section ?

Any direction would be appreciated.

 
First create a parameter {?sort} with options of:
"Type-Asc", "Type-Desc", "Reference-Asc","Reference-Desc", "LogStatus-Asc","LogStatus-Desc". Then create two formulas:

//{@sortasc}:
if {?sort} = "Type-Asc" then {table.type} else
if {?sort} = "Reference-Asc" then {table.reference} else
if {?sort} = "LogStatus-Asc" then {table.logstatus}

//{@sortdesc}:
if {?sort} = "Type-Desc" then {table.type} else
if {?sort} = "Reference-Desc" then {table.reference} else
if {?sort} = "LogStatus-Desc" then {table.logstatus}

Go to report->sort records and add both of these formulas, setting {@sortasc} to ascending,, and {@sortdesc} to descending order.

-LB
 
Thanks LB.. Works perfect...STAR for you.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top