Author |
Message |
Macavity
Groupie
Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
|
 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 Logged |
|
Macavity
Groupie
Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
|
 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 Logged |
|
Sastry
Moderator
Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
|
 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 Logged |
|
Macavity
Groupie
Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
|
 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 Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|
 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 Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
 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 Logged |
|
Macavity
Groupie
Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
|
 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 Logged |
|
DBlank
Moderator
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
|
 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 Logged |
|
Macavity
Groupie
Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
|
 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 Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
 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 Logged |
|
|