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

How to Sort by ending #

Status
Not open for further replies.
Sep 24, 2003
34
US
Hi All,

I am new to Crystal and I need to take a report that we have and sort it by ending cutomer #. Example.
We want to have the report where the Customer # will have everything ending in 0-4 on one page and 5-9 on the next page. Any ideas on how to set this up?

Thank you!!
 
If you just mean the last digit of a number, try:

right(trim(totext({table.custnum},0,"")),1)

This assumes that it's a numeric to start with, you didn't bother to post this.

If it's a string, try:

right(trim({table.custnum}),1)

Now use the formula for sorting.

-k
 
Sorry.

I meant I want to show the whole # but sort it my the customer #.

ex. if customer number is 123456789 and 1234567890

I want the one first customer # 123456789 to be on the page that shows the last digit ending between 5-9

and customer id 1234567890 on another page since it is between 0-4
I still want the whole customer # to show up.
 
What is the datatype of the customer number?

if it is a number, then create a formula like:

if right(totext({table.cust},0,""),1) in 0 to 4 then
"0 to 4" else
if right(totext({table.cust},0,""),1) in 5 to 9 then
"5 to 9"

Insert a group on this, and then go to the section expert->group footer->new page after->x+2 and enter:
not onlastrecord

This will separate the values into separate pages. You can add your customer number to the report so that the whole value displays. You might also want to go to report->sort records and sort by the customer number.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top