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!

Rolling A - Z 1

Status
Not open for further replies.

jtr9999

MIS
Jan 25, 2008
27
US
Is there a way to do a rolling count of the alphabet per page instead of numbers? So page 1 = A, 2 = B, 3 = C and then repeat once it hits page 26. So page 27 = A, 28 = B.

thanks
Jonathan
 
I thought about using the mod and pagenumber to add to the CHR function. But I am getting inconsistent results. My brain is getting too tired today. I may have time tomorrow.
 
I was sure I had done this in a blog post recently but it looks like I never posted it so I will post it here and then post it on my blog later in the week. Here is how I would do it if I wanted upper case letters:

[tt]Local NumberVar x:= remainder (PageNumber - 1 , 26) + 1 ;
CHR (x + 64)[/tt]

Replace 64 with 96 if you want lower case letters.

The first line creates the rolling 1 to 26, and the second line converts it into the corresponding letter. I did it in two steps so that I could test the numbers separately and make sure that they were right. Note that the -1/+1 is what makes it roll from 26 to 1, instead of from 25 to 0.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top