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!

MY FORMULAS WON'T CROSS THE PAGE BREAK!

Status
Not open for further replies.

suskenno

Technical User
Jun 10, 2002
6
US
I have a report that for some reason, the formulas won't cross the page break. If the page break occurs in the middle of the list that is being totalled, the total only includes those amounts that show on the new page. This report contains several subreports in order to obtain these totals. What am I missing here? Help!
 
Is your total being calculated with varables and if so do you have another formula in the group header that resets it to zero? Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
dgillz is probably correct here...

If your initialization formula is placed in a group header make sure you use the "inrepeatedGroupHeader" function to protect the total during a page break....

something like this

@Initialization

if not inRepeatedGroupHeader then
numbervar totalAmt := 0;



if it is in the page header then it is a little trickier

If this total is only being done the once then place it in the report header instead.

If there are groups used in the report then usually the total is based on a specific group so move the formula into the Group header and modify as above.

If for some reason it is not possible to move the formula out of the Page header then explain why and we will use some kind of flag to solve the problem. Jim Broadbent
 
Well, I tried your suggestions, and they worked, kind of. Now what I get is a running total.

I guess I should let you know what the objective is. This is a report showing the profit margin of all items sold for the last month, grouped by salesman first, and second by sales orders, giving me two group headers. The report is designed to subtotal each sales order, and then subtotal all sales orders by salesman, with a grand total at the end.

The subtotals I'm having problems with are the sales orders; the salesman's totals seem to work okay, but when I copy the format, it REALLY doesn't work. I would appreciate ANY help I could get. My bosses are very frustrated right now!
 
When you say "when I copy the format", what does that mean?

Do you have the gross profit in the detail section working properly? If so all you need to do is the following:

1)right click on the gross profit field, select insert summary, and sum by salesperson.

2)right click on the gross profit field, select insert summary, and sum by Sales Order.

You are done. Software Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
My profit formula seem to work okay, I haven't had any problems with it. It is only the subtotal for the profit formulas that don't seem to work. And I say formulas because there are several involved with achieving the end result. The profit formula is a global number variation using "if, then, else" based on History Detail.Line Type, as follows:

whileprintingrecords;
global numbervar profit;

If HistoryDetail.LineType = "1" then profit = (LastUnitPrice - StdCost) * RevisedOrderQuantity else
if HistoryDetail.LineType = "5" the profit = (LastUnitPrice - DropShipUnitCost) * RevisedOrderQuantity else profit = 0

The formula for the Subtotal of Sales Order Profit is:

whileprintingrecords;

global numbervar profit;
numbervar salesordertotalprofit;

salesordertotalprofit:= salesordertotalprofit + profit;

This is the formula that is used to show my subtotal on the report is called "showsalesordertotalprofit":

whileprintingrecords;

global numbervar salesordertotalprofit;

salesordertotalprofit;

Does any of this make sense? I feel a little overwhelmed with all the different formulas to get one total, and I appreciate all your help. Thanks guys!
 
Sukenna,

get rid of all your variable, they are not needed. Create one formula as follows:

If {HistoryDetail.LineType}="1" then (LastUnitPrice}-{StdCost)* {RevisedOrderQuantity} else
if {HistoryDetail.LineType}="5" then (LastUnitPrice}-{DropShipUnitCost)*{RevisedOrderQuantity} else 0

Then sum this formula as I suggested above. This is the only formula needed to do this report.

Software Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Suskenno,

get rid of all your variable, they are not needed. Create one formula as follows:

If {HistoryDetail.LineType}="1" then (LastUnitPrice}-{StdCost)* {RevisedOrderQuantity} else
if {HistoryDetail.LineType}="5" then (LastUnitPrice}-{DropShipUnitCost)*{RevisedOrderQuantity} else 0

Then sum this formula as I suggested above. This is the only formula needed to do this report.

Software Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
I was finally able to get back to this, and for the most part, it works beautifully! But, strangely enough, I am now getting a return of the total last unit price for EVERY OTHER ITEM! I don't get it...I have looked, and looked, and there is no rhyme nor reason, it is literally every other item, misc. part or not. Can you help me again?

Oh yeah, I used your fix on another report, and it worked there, too. Thank you!![bigsmile]
 
Please email me your report, with saved data and I will take a look. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top