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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nthLargest on same line

Status
Not open for further replies.

awaywifye

Programmer
Jul 1, 2004
24
0
0
US
Using CR 8.5 and Active Data (field definitions). Report is run in a VB program.

The report points to a table that contains a project code and sum of time.

IE:
Code Time
A12 10.5
2847 2.75
1112 5.75

On the report I want to display the time and code from largest to smallest on one line:
A12 10.5 1112 5.75 2847 2.75

nthlargest works great for Time fields, but when I try for the Code fields they're sorted alphabetically. Any suggestions?
 
If you sort the report in descending order by time, you could then write a formula like this to place in the detail section:

whileprintingrecords;
stringvar x;
x := x + {table.code}+" "+totext({table.time},2)+" ";

Then in the report footer use:

whileprintingrecords;
stringvar x;

In 8.5, you might run up against the 254-character string limit though, unless you just have a few records. If this is at a group level, add a reset formula in the group header:

whileprintingrecords;
stringvar x := "";

-LB
 
Thanks! I had to mess around with spacing between the fields (it has to print into specific areas on the report), but it worked great.
 
You could also subsitute chr(9) (tabs) for the spaces, if that helps.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top