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

Crystal Report Formula help .. 1

Status
Not open for further replies.

Programmer24

Programmer
Jan 6, 2011
6
0
0
US
Hello all, I have a strange requirement and I am having a very hard time to solve it.

We have a report with N number of pages, which is grouped on a field 'X'. On every Page's group footer, alphabets should be displayed like A, B, C ... Z, AA, AB ... AZ etc., These alphabets should be reset once the group changes.

Can one of you please help?

Thanks for your help
 
Can you clarify whether you want the alphabetic character in the page footer or the group footer? If the group footer, do you have the group footer formatted to "New page after"?

Is the intent to show the alphabetic character that corresponds to the first letter of the group field? Or is it that you want one letter per page footer, starting with "A" and progressing through characters until the group resets and that this does not relate to the content of the group field?

-LB
 
Hi,
Once you have clarified LB's issues to could try something like this:
Perhaps the letters can be displayed by creating a variable for a running total that resets to 1 on a group change then using an array in a formula something like this:

@AlphaList
Code:
StringVar Array Alphas := MakeArray('A','B','C','D','E',...);
[COLOR=GREEN]//MAKE AS MANY ENTRIES AS YOU WOULD EXPECT TO NEED[/COLOR]

Alphas[RunningTotalVariablehere]

This is just an attempt, since I do not have a copy of CR handy, but it should give some idea of what may work.

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks for responding lbass and Turkbear.

@lbass : I have to show these alphabetic characters on the footer of each page, I thought it would be better if we show it in 'X' Group Footer because it has to reset once the "X" Group changes. Please correct me if I am wrong.

This scenario is correct. "is it that you want one letter per page footer, starting with "A" and progressing through characters until the group resets and that this does not relate to the content of the group field"

@Turkbear : I think the hard coding of letters may not work in my case because, there will be thousands of pages as output for this report.
 
Add the following to your page footer (NOT your group footer):

//{@alph}:
whileprintingrecords;
numbervar i := i + 1;
stringvar x;
stringvar y;
numbervar k;
if i <= 26 then
x := chr(65+i-1);
if i > 26 then (
i := 1;
x := chr(65+i-1);
y := x;
if remainder(i-1,26)=0 then (
k := k + 1;
y := chr(65+k-1)
));
y+x;

In the group header, add this formula:

//{@reset}:
whileprintingrecords;
numbervar i;
stringvar x;
stringvar y;
numbervar k;
if not inrepeatedgroupheader then (
i := 0;
k := 0;
x := "";
y := ""
);

This would take you from "A" to "ZZ". Not sure what you would want to happen after that--or if you would have so many pages that you would need to figure that out.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top