Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: total doesn't display value Post Reply Post New Topic
Page  of 2 Next >>
Author Message
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet Topic: total doesn't display value
    Posted: 23 Jul 2013 at 4:06am
Hi,

I have a formula field @balance. I can't put a summary on it, so I created another formula field @totbal :

shared numbervar totbal;

totbal = totbal + @balance

I thought that should work, but it displays False instead of a value

Why ?
 
The @balance formula
IP IP Logged
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet Posted: 23 Jul 2013 at 4:09am
the @balance formula :

if {order} <> previous({order} and {invoice} = previous({invoice} then

shared numbervar balance:= balance + previous({amount} else
{amount}
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 23 Jul 2013 at 7:02am
Hi
 
You are trying with out assigning, try this :
 
shared numbervar totbal;

totbal := totbal + @balance
 
 
Thanks,
Sastry
IP IP Logged
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet Posted: 24 Jul 2013 at 3:33am
that's what I did, it was a typo.

i changed it to totbal:= totbal + shared numbervar balance

now it gives a number instead of true/false, however it's zero

any other ways to summarize @balance ?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Jul 2013 at 3:54am
try changing the balance formula
 
shared numbervar balance;
 
shared numbervar balance:= if {order} <> previous({order} and {invoice} = previous({invoice} then balance + previous({amount} else
balance
 
or use a running total
I would need to see some row level data with the order and invoice data and how you want it calculated to tell exactly how to do that
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 24 Jul 2013 at 5:13am
As someone just pointed out to me, you might try adding the Evaluation time of WhilePrinting

This was exactly the scenario specified, a formula updating a shared variable.

Try and see, what's the worse that can happen?

HTH
IP IP Logged
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet Posted: 24 Jul 2013 at 5:38am
Found the problem, now another one occurs.

in the @balance instead of 'else {amount} it should be
shared numbervar balance:= {amount}

I also added whileprintingrecords.
On the first line however, @balance is empty. I displayed the recordnumber,
it's 1 so I added onfirstrecord

still @balance is empty on the first line

any ideas ?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Jul 2013 at 5:40am
becasue you are using previous() and there is no previous on the first record (it is like looking at a NULL).
change the evaluation formula option to "use default options for nulls"
IP IP Logged
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet Posted: 24 Jul 2013 at 6:33am
done that, now it displays 0,00
however, the test should be false so
else shared numbervar balance:= {amount} and that 's 108.000
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 24 Jul 2013 at 6:49am
Not necessarily...Previous and Next act oddly at the end/beginning of the set. They point to the first and last record respectively...not what i would expect.

Try using the onFirstRecord. I'm not sure if that is the only sure-fire way to check...

HTH

ps, as a check that the Previous and current are on the same record print the values in a formula...I know pretty simple and obvious
IP IP Logged
Page  of 2 Next >>
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.035 seconds.