Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula summary problems... Post Reply Post New Topic
Author Message
Slive
Newbie
Newbie
Avatar

Joined: 17 Jan 2011
Online Status: Offline
Posts: 6
Quote Slive Replybullet Topic: Formula summary problems...
     Posted: 25 Oct 2012 at 10:37pm
Hi there,
 
How do I summarise a formula field? I get it right for quantity shipped using a running total but not for my retail field with the following formula:
 
sum ({OEINVD.QTYSHIPPED}, {OEINVD.ITEM}) * {OEINVD.UNITPRICE}
 
I tried removing the sum from the formula but that messes up my figures.
 
I also need to summarise my GP%, here's the formula:
 
 If {@Retail} = 0 then 0 else {@GP} / {@Retail} * 100
 
I can't use RT here or at least I think I can't, I tried and failed.
 
I've looked through a few supposed solutions online but can't find anything adaptable or solid.
 
Thanks for helping a novice :)
 
The computer does what you told it to do, not what you thought you told it to do
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 26 Oct 2012 at 2:45am
use shared variables

IP IP Logged
Slive
Newbie
Newbie
Avatar

Joined: 17 Jan 2011
Online Status: Offline
Posts: 6
Quote Slive Replybullet Posted: 28 Oct 2012 at 7:53pm
Do you have any examples?

Thanks.
The computer does what you told it to do, not what you thought you told it to do
IP IP Logged
Slive
Newbie
Newbie
Avatar

Joined: 17 Jan 2011
Online Status: Offline
Posts: 6
Quote Slive Replybullet Posted: 28 Oct 2012 at 11:42pm
Hi there,

Ok I read up on shared variables and used the following formulas for shared vars:

@RetailReset (I put this in the group header)
whileprintingrecords ;
shared numbervar RunT;
RunT := 0

@RetailCalc (in the details section)
shared numbervar RunT;
RunT := RunT + {@Retail}

@RetailDisplay (in the group footer)
whileprintingrecords;
shared numbervar RunT;
RunT

This seemed to work fine but I came across one total that   is out by a bit. I'm not sure why but it could be something to do with the way retail is calculated. Is it correct putting the reset in the group header or should I drop it in the section before the details as well/only?

Thanks for the help.

Edited by Slive - 28 Oct 2012 at 11:44pm
The computer does what you told it to do, not what you thought you told it to do
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum