×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Calculate with summary fields in break footer.

## Calculate with summary fields in break footer.

(OP)
How can I Calculate with summary fields in break footer, and place it in the same Footer.
Footer display's the total number of product and the total amount of the product.
And I want to display the average price by dividing those two.
The price for each product per record is different.

Clarion 6.3/7/8

Regards leo

### RE: Calculate with summary fields in break footer.

Hi Leo,

IIRC, Clarion 7 introduced the AVE attribute for that. Also, check on SUM in the help as using SUM(LocalVar) ensures that the LocalVar contains the value.

Regards

### RE: Calculate with summary fields in break footer.

(OP)
Hoi ShankarJ,

Thanks for responding.
The AVE gives the Average of only the price.
In the attachment you see the result.

Regards.

### RE: Calculate with summary fields in break footer.

Hi Leo,

The reason the average is failing is because of the NEGATIVE qty & amount.

You could define some local variables ::

TOT:Product   DECIMAL(13,2)
TOT:Amount    DECIMAL(13,2)
TOT:Average   DECIMAL(13,2)

In the total detail band, make sure you use the SUM(TOT:Product) & SUM(TOT:Amount) for the totals of Product & amount. And, after every detail printing do a TOT:Average = TOT:Amount / TOT:Product.
Assuming that the TOT:Product & TOT:Amount contains the running totals after every detail printing, the TOT:Average will be calculated correctly.

Regards

### RE: Calculate with summary fields in break footer.

(OP)
Hoi ShankarJ,

When I use both of the embeddpoints ther result is the same.
the TOT:Average is calculated after printing the footer.

That's where I stucked before opening this Thread.
Am I missing the right embeddpoint?

Regards Leo

### RE: Calculate with summary fields in break footer.

Hi Leo,

The best way to find the correct embed is to go to Source mode in the Embeds and find the first embed after PRINT(RPT:Detail).

If that does not work, than I suggest you convert your HEADER/FOOTER bands into DETAIL bands and use the Report Properties -> Breaks section to configure your breaks. You may need to define some local variables to hold the totals but this gives you more flexibility.

Regards

### RE: Calculate with summary fields in break footer.

(OP)
Hi ShankarJ,

Didn't find a embed to make it work.
Converting Header/Footer bands into Detail is new for me.
I'll think about later when I didn't get thinks working.

My solution for this moment: See attachment.

Thanks for getting me in the position to find a solution.
If you have another suggestions they are welcome.

Regards Leo

### RE: Calculate with summary fields in break footer.

Hi Leo,

What you have done will work i.e. add to the totals & calculate the average before the detail printing.

I never use the automatic BREAKs and always hand code my breaks since it gives me better control.

Regards

### RE: Calculate with summary fields in break footer.

Hi!

Forgot to add, the BIGGEST limitation of the Clarion report engine is that it generates NO events before & after a break/page.

Regards

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!