Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Increment number based on criteria Post Reply Post New Topic
Author Message
leighturner
Newbie
Newbie


Joined: 03 Mar 2010
Online Status: Offline
Posts: 3
Quote leighturner Replybullet Topic: Increment number based on criteria
    Posted: 21 Dec 2010 at 4:49am
Based on a previous formula @NewPallet, every time this occurs I would like to add 1 onto a count value.
 
For example:
 
Head1    NewPallet    Count
1                                    1
2                                    1
3                                    1
4              NewPal          2
5                                    2
6              NewPal          3
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 21 Dec 2010 at 5:29am
shared numbervar iCount;
if @newPallet then
  iCount := Count + 1;
 
iCount
 
this assumes that @newPallet returns true of false, adjust the if statement as needed.
 
HTH
IP IP Logged
leighturner
Newbie
Newbie


Joined: 03 Mar 2010
Online Status: Offline
Posts: 3
Quote leighturner Replybullet Posted: 21 Dec 2010 at 5:36am
Thank you for the response.
 
My formula is:
 
@iCount
shared numbervar iCount;
if {@NewPallet} = "Start of new pallet"
then  iCount = iCount + 1;
 
@iCountTot
shared numbervar iCount;
iCount
I am getting zero for every record?


Edited by leighturner - 21 Dec 2010 at 6:01am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 22 Dec 2010 at 3:26am
it looks ok, did you place the iCount formula on the report...I have forgotten to do that ;)  I am also assuming that {@newPallet} returns that exact verbiage, otherwise it will never increment.
 
you also could move the increment logic to the {@newPallet} formula, and when it determines it is a new pallet to increment the shared variable
 
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.