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

3 Formula Approach

Status
Not open for further replies.
Jan 3, 2001
66
US
I have the folling code in formula fields:
Header:

WhileReadingRecords ;
NumberVar X := 0 ;
//end

Detail:

WhileReadingRecords ;
NumberVar X ;
X = X + 1;
//end

Footer:

WhileReadingRecords ;
NumberVar X ;
//end


The display values in the header and footer is 0 and in the detail section is False. What am I doing wrong?

Carolyn
 
Should be WhilePRINTINGRecords Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
and:
X = X + 1;

should be
X := X + 1;

in Crystal Syntax Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Thank you for your advice that worked. Now I have an additional problem.

I want to create subtotals of these values. Based on the advice you gave me and other reading, I place the beginning variable in the report header. However, there are sub groupings in the report for which I want to get these same totals. If I placed the beginning variable in the Group Header for the subgrouping, I did not get an evaluation of the formula.

How do I get totals for groups?

Thanks,
Carolyn
 
You need 2 sets of 3 fields, using 2 different variable names. One set for the grand totals and one set for the subtotals. Actually, you don't need the reset formula in the RH for a grand total, but it doesn't hurt either. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
I think you are one step away fromt the solution. Place the Initial Variable (NumberVar X:=0) in the GRrup Header (as you did correctly), but you ALSO need to move your Ending Variable (NumberVar X) to the Group Header (NOT Report Header)

I know it works, I use Running Totals in every report that deals with Subtotals.

So, if you place formula #1 in Group Header, formula #2 in Details and formula #3 in Group Footer, you get the subtotal. Now, in order to have the Grand Total of these, you need to make another set of 3 formulas with placing formula #1 in the Report Header and formula #3 in the Report Footer.

It works, please try it.
 
By the way, in your formula #2 (which you correctly modified) you can simple put:

WhilePrintingRecords;
NumberVar X:=X+1

These are 2 lines instead of 3. :)
 
What appears to be happening is the group header is printed at the top of each page. Every time it appears at the top of the page, the variable is being set to 0.

I do not want it to change until there is actually a new grouping.

Thank you,

Carolyn
 
You have a repeated group header, so use a condition to say:

If InRepeatedGroupHeader
then x:=x
else x:=0 Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Thank you Ken. That worked!

I searched the user documentation to see if that function was described. The word was not even found.

Carolyn

 
It is in the online help. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
I'm reading with interest this thread. I'm confused. In which formula does this go:

If InRepeatedGroupHeader
then x:=x
else x:=0

I was looking for the exact problem solution but I have multiple groups. I set up 2 sets of 3 formulas as indicated.(I omit grand totals right now for clarification). It works when I do it for Group 1 but fails when I add the subtotal formulas for Group 2. Also, it adds every other grouping of Group 1 correctly (first and 3rd are correct, 2 and 4 are not).
I'm using 2 different variables X,Group1, Y Group2.
What am I doing wrong?
Thanks.

lgb
 
LGB,
This is for a reset formula in a GH, when the GH is set to repeat at the top of each page. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Oh, I get it.
But, what about the multiple groups and subtotals question?
I still have that problem.

lgb
 
Every subtotal has to have its own 3 formulas and its own variable. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top