Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Formula that references Max and Min summary values Post Reply Post New Topic
Author Message
rmdalrk
Newbie
Newbie


Joined: 28 Aug 2013
Online Status: Offline
Posts: 4
Quote rmdalrk Replybullet Topic: Formula that references Max and Min summary values
    Posted: 04 Sep 2013 at 11:51am
I have a formula called Average Days that displays the average number of days between invoices.  Here is the formula:

{@DateDiff Spread}/Count ({ARFID.INVOICE_NUMBER}, {ARFID.CUST_PART_ID})

Here is the DateDiff Spread formula referenced above:

(Maximum ({ARFIM.INVOICE_DATE}, {ARFID.CUST_PART_ID})-Minimum ({ARFIM.INVOICE_DATE}, {ARFID.CUST_PART_ID}))+{@Current Date - Max}

The Average Days formula is working and displaying the correct values.  However, I need to be able to use its results as part of an aglorithm formula that assigns weights to other values then displays 1 final value.

When I reference the Average Days formula in another formula, I get an error:

"A summary has been specified on a non-recurring field.
Details: @Sales Sum"

Sales Sum is the formula that should display the final value.  I think the issue is that I'm trying to reference a formula that references Maximum and Minimum summary values, but I'm not sure how to work around this.

Any help would be great.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Sep 2013 at 4:48am
try using shared variable formulas to get your other values
IP IP Logged
rmdalrk
Newbie
Newbie


Joined: 28 Aug 2013
Online Status: Offline
Posts: 4
Quote rmdalrk Replybullet Posted: 05 Sep 2013 at 10:48am
Thank you for the reply.

I haven't worked with variables much, but here is what I tried with no success.

I edited the Average Days formula to:

whileprintingrecords;

Shared NumberVar avgdays := {@DateDiff Spread}/Count ({ARFID.INVOICE_NUMBER}, {ARFID.CUST_PART_ID});

I then created a new formula called AvgDaysVariable and called the variable:

Shared NumberVar avgdays;

The variable value displays correctly but I'm still unable to use the variable value in another formula.

I tried using the variable in this formula:

({@QTY Previous 30 Days}*10)+{@QTY Previous Year}*1.5 + shared numbervar avgdays

I also tried calling the other formula field:

({@QTY Previous 30 Days}*10)+{@QTY Previous Year}*1.5 + {@AvgDaysVariable}

Either way, I'm still getting the same error.

IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 09 Sep 2013 at 7:39am
are you able to use SQL?
IP IP Logged
rmdalrk
Newbie
Newbie


Joined: 28 Aug 2013
Online Status: Offline
Posts: 4
Quote rmdalrk Replybullet Posted: 09 Sep 2013 at 7:55am
I don't have much experience with SQL.
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 09 Sep 2013 at 8:16am
well my idea was to create a command
your main select which you could look up in
database tab >> show sql query
past that query and i'll see if i can help you



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.