Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: customize group at crystal report Post Reply Post New Topic
Author Message
melvintcs
Newbie
Newbie


Joined: 15 Nov 2011
Online Status: Offline
Posts: 2
Quote melvintcs Replybullet Topic: customize group at crystal report
    Posted: 15 Nov 2011 at 5:37pm
Database:

Category        total

     A                 100

     A                  80

    B                   50

    C                   90



Crystal Report:

    C                 90

    A               180   Total 1: 270     



    B                 50    Total 2: 50

--------------------------------------------

                               Total 3: 220 (Total 1 - Total 2)

---------------------------------------------

I able to group the category, but it group/give me the total of 'A', 'B', 'C' accordingly. how i can get the value, something like set it to variable and use it later?

There are few condition i want to make

1) I able to rearrange the category. (which come first)

2) able to use 'total 1', 'total 2' anyhow i wanted it to be.

below is the sample picture i used for the report, please advice... =)

IP IP Logged
melvintcs
Newbie
Newbie


Joined: 15 Nov 2011
Online Status: Offline
Posts: 2
Quote melvintcs Replybullet Posted: 16 Nov 2011 at 9:02pm
no one can help me? or i make the question easier:

How i can get the value of "Total 1 - Total 2"?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 17 Nov 2011 at 4:27am
I don't have time to check in on all the forums, as someone else mentioned, we are volunteers, well enough of that line...
 
you can create a shared variable (or global, your choice) to save a value and use it later, like:
shared numbervar lastTotal;
local numbervar thisTotal := sum({table.field}, {group});
local numbervar dispTotal := lastTotal - thisTotal;
 
lastTotal := lastTotal - thisTotal;
dispTotal;
 
or something like that if you wanted.
 
rearranging the groups is another issue, and it depends on what you want to rearrange on.  You might be able to reorder them based on an Aggregate function, like SUM, but I haven't tried it myself.
 
Usually, my rule of thumb is you can change the grouping dynamically by using values that is in your 'raw' data, whatever is in your tables or is the output of a stored proc or view, and while an Aggregate is kinda in the 'raw' data, I am not sure that CR will do it.
 
If you wanted to rearrange them based on a shared variable, it won't work, as the value is not known until after group is done being printed, at which point it is too late rearrange the data.
 
HTH
IP IP Logged
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.016 seconds.