Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula based on results of Formula in Group Post Reply Post New Topic
Author Message
Rubengek
Newbie
Newbie


Joined: 29 Jun 2010
Online Status: Offline
Posts: 2
Quote Rubengek Replybullet Topic: Formula based on results of Formula in Group
    Posted: 29 Jun 2010 at 9:12am
Hi,

I have an easy report with records grouped by 1 field.
In the group summary, i have a formula which calculates a percentage.

At the end (reportfooter), i have to add a formula which calculates the lowest percentage of the groups.

I tried to calculate this with a global var, (and assign it in the percentage formula in every group) but i doesn't seems to work.

I think it's easy for an expert to do this.

Can somebody help me ?
The only formula i have now is the correct @percentage in the group:
(100*Sum ({ObjectivesResult.Totaalpunten}, {ObjectivesResult.Productline}) / Average ({ObjectivesResult.objective}, {ObjectivesResult.Productline}))




IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 30 Jun 2010 at 5:43am
have you tried something like:
global numbervar aPercent;
local numbervar this := (100*Sum ({ObjectivesResult.Totaalpunten}, {ObjectivesResult.Productline}) / Average ({ObjectivesResult.objective}, {ObjectivesResult.Productline}));
 
if this < aPercent then
  aPercent := this;
 
this;
 
 
this will calculate the percentage and if it is smaller, assign it to the global, finally it prints the percentage.
 
if the footer you would want:
global numbevar aPercent
 
if the header
global numbervar aPercent := 500
 
 
HTH
IP IP Logged
Rubengek
Newbie
Newbie


Joined: 29 Jun 2010
Online Status: Offline
Posts: 2
Quote Rubengek Replybullet Posted: 30 Jun 2010 at 9:01am

Thanks for the reply,

What i tried is this in my @percentage formula:
local numbervar perc := 100*Sum ({ObjectivesResult.Totaalpunten})/{#TotaalObjectief};
Global Numbervar minpercentage;
 
if(perc > 0 and (perc < minpercentage or minpercentage=0)) then
    minpercentage := perc;
 
 
 
It seems like the var minpercentage is empty and this part in the if-clause, returns false, but i don't know why (looks so easy)
 
My @Lowest formula returns this variabele after a "EvaluateAfter({@Percentage});" statement
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 30 Jun 2010 at 10:30am
you know the close ) is missing on perc...but I would think that CR would catch that.
 
well, have you tried setting it in the report header?
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.