Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: I want to create a Group that,Is that feasible? Post Reply Post New Topic
Author Message
Dean
Newbie
Newbie
Avatar

Joined: 01 Jun 2010
Location: Taiwan
Online Status: Offline
Posts: 14
Quote Dean Replybullet Topic: I want to create a Group that,Is that feasible?
     Posted: 06 Jul 2010 at 2:21am

Hi, Expert
I want to limit record number(50 records) per page,
and it will have a total column which is amount Salary,
so now I had set some formulas into report

First(in report Details)
------------------------------------------------------------
WhilePrintingRecords;
Global   numbervar   DataCount   :=   DataCount   +   1;

ps.This variable counts record number and limits record within 50 records per page
   when record passover 50, it will re-set variable to 0(this formulas set in Group Footer)
------------------------------------------------------------
second(in Group Footer)
------------------------------------------------------------
WhilePrintingRecords;
   Global numbervar DataCount := 0;
  
ps.for re-set variable
------------------------------------------------------------
third(New Page After)
------------------------------------------------------------
Truncate ({@DataCount}/50)*50={@DataCount} and OnLastRecord=false

ps.For Next page
------------------------------------------------------------
Fourth
------------------------------------------------------------
WhilePrintingRecords;
Global numbervar pagetol;
   salarytol:=salarytol +{table;1.amount}  
------------------------------------------------------------ 
Fifth
------------------------------------------------------------ 
Global numbervar pagetol;
if (Truncate ({@DataCount}/50)*50)={@DataCount} then
   pagetol:=0;
------------------------------------------------------------    

If I want to create a Group that is Group by page(50 records per page), because I want
to grand total of salary per page,Is that feasible?
How to achieve this goal??

Thanks & Regards



Edited by Dean - 12 Jul 2010 at 8:37pm
Have a Nice Day!!
Best Regards.

Questions and Answers seem like same. All in your mind.

Larry Lai
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 06 Jul 2010 at 3:31am
you can't group by the record counter...CR doesn't 'know' its value until too late. 
 
You could use global variables and place the result in the page footer, which would accomplish the same thing.  You could create multiple page footers so that you can do conditional hiding of the footer at the end of the report...or however it is to be formatted.
 
as a note, since @DataCount just goes from 0-50, why not just check if @DataCount = 50...which is all that the (truncate()/50)*50 is checking...keep it simple is always a good rule
 
HTH
IP IP Logged
Dean
Newbie
Newbie
Avatar

Joined: 01 Jun 2010
Location: Taiwan
Online Status: Offline
Posts: 14
Quote Dean Replybullet Posted: 06 Jul 2010 at 5:09am
Thanks lockwelle

Actually, my care is Report View,
my report will have Three Summary columns,
one is for 50 records,
second is for data type,
another is for all of records.
I will put the First Summary column behind(below) the last records
So it will look like "Grand total"(for 50 records 1 total).
And the Second Summary column will lay on Group footer(sum data group by data type).
And the last Summary column will lay on every page's bottom(sum all of data).
If I put first summary column in page footer, It will lay on bottom of page, not behind the last records(per fiftieth record).
So I think if I create group1 for 50 records(put in first Summary column on group1 footer) and group2 for data type(put in second Summary column on group2 footer),
then put the last summary column into page footer. Maybe, it will look like what i want.


Thanks & Regards
Have a Nice Day!!
Best Regards.

Questions and Answers seem like same. All in your mind.

Larry Lai
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 06 Jul 2010 at 5:32am
ok, build separate sections and display them as needed...hiding them the rest of the time...the idea is the same, reset the variable to 0, increment, display...
 
 
IP IP Logged
Dean
Newbie
Newbie
Avatar

Joined: 01 Jun 2010
Location: Taiwan
Online Status: Offline
Posts: 14
Quote Dean Replybullet Posted: 06 Jul 2010 at 2:49pm
Originally posted by lockwelle

ok, build separate sections and display them as needed...hiding them the rest of the time...the idea is the same, reset the variable to 0, increment, display...
 
 
 
But how do I build a group which group by Page (or 50 records)??
Because Group is not allow dynamic variable.
If I set group to forumla which I had builded, it will have mistake.
 
So how to build a group(separate sections) like this??
 
thanks your time
Thanks a lot & Regards
Have a Nice Day!!
Best Regards.

Questions and Answers seem like same. All in your mind.

Larry Lai
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 07 Jul 2010 at 3:22am
you can't.  build a group. put in the counter, put in either a running total or a global variable that will track the total for that page/group.  put the display in a separate detail section that is only displayed every 50 lines or the end of the group or whenever you want it.  increment the variable/running total for every detail line.  reset it when groups change or the page changes. 
 
that should resolve most of the issues.
 
HTH
IP IP Logged
Dean
Newbie
Newbie
Avatar

Joined: 01 Jun 2010
Location: Taiwan
Online Status: Offline
Posts: 14
Quote Dean Replybullet Posted: 12 Jul 2010 at 8:36pm
Really Thanks your time...Smile
 
In the end, I went to group data in DB, Added a Column to separate each data, and use this column to Sum and count.
I thought this is more easy and more efficient way to solve my problem..
 
Really appreciateClap
 
Thanks and Best Regards
Have a Nice Day!!
Best Regards.

Questions and Answers seem like same. All in your mind.

Larry Lai
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