Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Reset group variable Post Reply Post New Topic
Author Message
fanan
Newbie
Newbie
Avatar

Joined: 02 Jan 2011
Location: Egypt
Online Status: Offline
Posts: 28
Quote fanan Replybullet Topic: Reset group variable
     Posted: 24 Dec 2014 at 6:30am
hello everyone,
i have productmovement report with two groups
in each group i get the records and do some calculations
in the header but the variable doesn't reset
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Dec 2014 at 6:36am
Assumiong you are referring to shared variable formulas...
1 - in general you do not want to do calculations in a header as they will only look at first detail row of that group.
2 - for group calculations using shared variables in general you need 3 formulas.
the first goes in the group header and sets the variable to 0 (or whatever your starting value should be) 
the second goes in the detail section and does the row level calculations
the third goes in the group footer to display the final result for that group
 


Edited by DBlank - 24 Dec 2014 at 6:37am
IP IP Logged
fanan
Newbie
Newbie
Avatar

Joined: 02 Jan 2011
Location: Egypt
Online Status: Offline
Posts: 28
Quote fanan Replybullet Posted: 24 Dec 2014 at 7:41am
thanks a lot for your reply
the report has start date so i have to calculate the quantity before this date and display it at the group header section as start quantity
thanks again
IP IP Logged
fanan
Newbie
Newbie
Avatar

Joined: 02 Jan 2011
Location: Egypt
Online Status: Offline
Posts: 28
Quote fanan Replybullet Posted: 24 Dec 2014 at 8:31am
do i have to use sub report ?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Dec 2014 at 3:04am
you can use a stored proc, a sub report, make a grouping and supress the values < your cut off date or just supress the rows < your cut off date.
the stored proc is the most efficient.
the sub report is probably the least efficient as it has to run multiple times, once per group.
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