Print Page | Close Window

auto increment when more than one code the same

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20363
Printed Date: 03 May 2024 at 1:49am


Topic: auto increment when more than one code the same
Posted By: SAM_N
Subject: auto increment when more than one code the same
Date Posted: 19 Jan 2014 at 7:37pm
Hi,
I have been asked to create a report with a feature that i am not sure how to achieve.

we are reporting on position codes and often there is more than one employee using the same position code as another.

I have been asked to auto increment any position code which appears more than once.

so: pos code ERT001 initially - then any further incidents of ERT001 are marked as ERT001/1, ERT001/2, ERT001/3 etc.

Any thoughts on how I can achieve this?

Thanks
Sam

-------------
Sam



Replies:
Posted By: lockwelle
Date Posted: 21 Jan 2014 at 4:59am
Either gather the data via a stored proc, which would allow you to change the value

or

group by the position code and then you could use a formula (or a group of them)
in the group header:
shared booleanvar addend:=false;
shared numbervar ending:=0;
if count({table.positionCode}) > 1 then addend:=true;
addend;
""//hide the random true

in the detail section for the group code:
shared booleanvar addend;
shared numbervar ending;
if addend then (
ending := ending + 1;
{table.positionCode} + "/" + totext(ending,"",0);
)
else
{table.positionCode}

one of these should do it for you....

HTH


Posted By: SAM_N
Date Posted: 21 Jan 2014 at 10:37am
Thanks for your reply - I will give that a go!
appreciate your time. Sam

-------------
Sam



Print Page | Close Window