Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: change previous values Post Reply Post New Topic
Author Message
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet Topic: change previous values
     Posted: 27 Sep 2013 at 5:40am
Hi, there wouldn't be by any chance be a way to change previously read values on a report ?

example
component        price
a                        12,00
b                         25,00
c                         0,00
d                         32,00

when one component has price 0 then the report should show all components price 0,00
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 27 Sep 2013 at 6:20am
Hi

Do the following :

Create one formula like

if Price = 0.00 then 0 else 1

insert this in your detail and insert summary.

Now insert a count on component and compare component count = summary then price else 0

Example data :
component        price   formula
a               12,00      1   
b               25,00      1
c                 0,00      0
d               32,00      1
---                      -----    
4 count                    3 summary

Now compare both count and summary


Thanks,
Sastry
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 27 Sep 2013 at 6:21am
you could try something like a formula
if minimum(price) = 0 then 0 else price
IP IP Logged
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet Posted: 28 Sep 2013 at 5:38am
yes, but the result should be :
component        price   formula
a               0,00      1   
b               0,00      1
c                0,00      0
d              0,00       1
---                      -----    
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 Oct 2013 at 5:07am
you can still have the formula that sets the 1 and 0...the 'actual' data is still valid, you are just altering the display...

In regards to kostya1122, his solution did match what your original post asked for...if 1 component is 0, then they all are.
IP IP Logged
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet Posted: 08 Oct 2013 at 3:57am
Problem

if minimum(@price) = 0 then 0 else 1

this field cannot be summarized

@price is a shared numbervar from a subreport

anyway to solve this ?

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 08 Oct 2013 at 4:48am
shared variables.
in this case the value is 'apparent' in the data and so cannot be summarized.

going a bit further, I doubt that minimum is making any difference as @price only has 1 value...the last one...unless it's an array, but I am not sure how that works (don't use arrays too often).

Also, since it a shared variable from a subreport, you cannot summarize it, as the value of the variable is not known before the subreport runs. To be summarized, the information has to be available in the raw data...so you can do counts like:
if {table.field } > x then 1 else 0
or
sum({table.field}, {grouping info})

as the data is there...subreports and other formulas that can only be determined at run time cannot be summarized.

it's just how I remember what can and cannot be summarized

HTH
IP IP Logged
Macavity
Groupie
Groupie


Joined: 24 Sep 2012
Online Status: Offline
Posts: 93
Quote Macavity Replybullet Posted: 09 Oct 2013 at 4:40am
The only way I see to solve this :

on the group header create a subreport that does the same as the main report.
In the subreport at the end we know we encountered a zero, return a flag to the main report.
now on the main report everything is read again, but now we have a flag to set prices to zero.


IP IP Logged
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