Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: if help Post Reply Post New Topic
<< Prev Page  of 3 Next >>
Author Message
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet 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 IP Logged
fabrizio
Newbie
Newbie


Joined: 10 Dec 2012
Online Status: Offline
Posts: 15
Quote fabrizio Replybullet 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 IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet 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 IP Logged
fabrizio
Newbie
Newbie


Joined: 10 Dec 2012
Online Status: Offline
Posts: 15
Quote fabrizio Replybullet Posted: 13 Dec 2012 at 3:17am
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}
 
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet 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 IP Logged
fabrizio
Newbie
Newbie


Joined: 10 Dec 2012
Online Status: Offline
Posts: 15
Quote fabrizio Replybullet 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 IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet 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 IP Logged
fabrizio
Newbie
Newbie


Joined: 10 Dec 2012
Online Status: Offline
Posts: 15
Quote fabrizio Replybullet Posted: 13 Dec 2012 at 4:16am
is there anyway to debug the formula
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet 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 IP Logged
fabrizio
Newbie
Newbie


Joined: 10 Dec 2012
Online Status: Offline
Posts: 15
Quote fabrizio Replybullet Posted: 13 Dec 2012 at 4:25am
ok thanks
IP IP Logged
<< Prev Page  of 3 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.031 seconds.