Author |
Message |
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|
 Posted: 12 Dec 2012 at 4:54am |
Honestly, it would be easiest to use Running Totals, and then work with them within the report. Your variables were declared correctly as far as I could tell though. If it's not working, I am not sure what is happening.
Personally, as a visual guy, I like running totals. This is how you can set them up.
----------------
In the running total setup like
Field to Summarize - PS_DIMENSIONE
Type of Summary - sum
Evaluate
use a formula
{VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J02*'
Reset
Never
-------- set this up as 'x' -----
---------------------------------
Field to Summarize - PS_DIMENSIONE
Type of Summary - sum
Evaluate
use a formula
{VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J07*' or {VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J08*'
Reset
Never
setup as 'y'
----
|
IP Logged |
|
fabrizio
Newbie
Joined: 10 Dec 2012
Online Status: Offline
Posts: 15
|
 Posted: 12 Dec 2012 at 5:16am |
I have done it but it doesn' work it works just for J02 but not for J07 and J08
|
IP Logged |
|
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|
 Posted: 12 Dec 2012 at 5:22am |
Try creating one for with just J07 (name x1) and another for J08 (name x2).
then just add one to the other within the formula and see if that works -- I honestly have no idea what is causing the issue with the second running total.
Matt
x1
{VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J07*'
x2
{VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J08*'
Edited by comatt1 - 12 Dec 2012 at 5:23am
|
IP Logged |
|
fabrizio
Newbie
Joined: 10 Dec 2012
Online Status: Offline
Posts: 15
|
 Posted: 13 Dec 2012 at 3:17am |
 I tried in this way too .....but nothing the second running total doesn't work Local numberVar x :=x ; Local numberVar y :=y ; Local numberVar z :=z ; x :={#nr_Vitellini};
y :={#nr_Vacche}; z :=x-y; if ({VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J10B*' and {#countCapre}>0) or ({VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J09B*' And {#countePecore}>0) or ({VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J11*' and {#countScrofe}>0) or ({VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J02*' and (x<=y)) then 0 else if ({VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J02*') and x>y then z*{VR_CLASSIFICA_PS.PS} else {VR_CLASSIFICA_PS.PS_AGG_NO_P}
|
IP Logged |
|
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|
 Posted: 13 Dec 2012 at 3:22am |
Originally posted by fabrizio
[IMG]smileys/smiley11.gif" height="17" width="17" align="absmiddle" alt="Dead" /> I tried in this way too .....but nothing the second running total doesn't work Local numberVar x :=x ; Local numberVar y :=y ; Local numberVar z :=z ; x :={#nr_Vitellini}; y :={#nr_Vacche}; z :=x-y; if ({VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J10B*' and {#countCapre}>0) or ({VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J09B*' And {#countePecore}>0) or ({VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J11*' and {#countScrofe}>0) or ({VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J02*' and (x<=y))then 0 else if ({VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J02*') and x>y then z*{VR_CLASSIFICA_PS.PS}else {VR_CLASSIFICA_PS.PS_AGG_NO_P}
Small reminder for z, you have to keep that logic you had for if x<=y then 0.
What happens with the failing running total? Do you just get 0?
|
IP Logged |
|
fabrizio
Newbie
Joined: 10 Dec 2012
Online Status: Offline
Posts: 15
|
 Posted: 13 Dec 2012 at 4:04am |
When there is this condition if ({VR_CLASSIFICA_PS.ID_ATT_ORIG} like '*J02*') and x>y I get the result of this operation : first subtotal(vitellini)* PS so it doesn't run the second subtotal to make the difference ((vitellini)-(vacche))*PS
|
IP Logged |
|
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|
 Posted: 13 Dec 2012 at 4:15am |
try laying out all of your running totals on the report body, and evaluate what is pulling correctly and what isn't
|
IP Logged |
|
fabrizio
Newbie
Joined: 10 Dec 2012
Online Status: Offline
Posts: 15
|
 Posted: 13 Dec 2012 at 4:16am |
is there anyway to debug the formula
|
IP Logged |
|
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|
 Posted: 13 Dec 2012 at 4:21am |
Other than the debugging that happens on save, I am not aware, however, I don't see any issue with your formula.
I would look at the data getting passed to the formula first. So put all the fields you can on the report body and see what looks as you expect and what doesn't.
|
IP Logged |
|
fabrizio
Newbie
Joined: 10 Dec 2012
Online Status: Offline
Posts: 15
|
 Posted: 13 Dec 2012 at 4:25am |
ok thanks
|
IP Logged |
|
|