Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Adding Columns Bases on Database Records Post Reply Post New Topic
Author Message
Ballou72
Newbie
Newbie
Avatar

Joined: 01 Oct 2008
Location: United States
Online Status: Offline
Posts: 5
Quote Ballou72 Replybullet Topic: Adding Columns Bases on Database Records
    Posted: 01 Oct 2008 at 9:39am
I am pulling codes out of a Database with a number associated with them.  The end user would like one line per employee, meaning if an employee has more then 1 code is it possible to add columns instead of Rows?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 01 Oct 2008 at 1:51pm
How many codes can an employee have?  How do you want to format this?  For example, do you want
employee name     code 1, code 2, code 4
or something like this:
                             code 1     code 2     code 3     code 4
employee name      Yes          Yes           No           Yes
 
-Dell
IP IP Logged
Ballou72
Newbie
Newbie
Avatar

Joined: 01 Oct 2008
Location: United States
Online Status: Offline
Posts: 5
Quote Ballou72 Replybullet Posted: 03 Oct 2008 at 10:02am
Maximum of around 10
IP IP Logged
Ballou72
Newbie
Newbie
Avatar

Joined: 01 Oct 2008
Location: United States
Online Status: Offline
Posts: 5
Quote Ballou72 Replybullet Posted: 03 Oct 2008 at 10:02am

The extra codes would come in extra rows

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 03 Oct 2008 at 10:19am

This is not going to be difficult.  For each code you're going to create a formula that looks something like this:

{@Code1}
StringVar code1;
if PreviousIsNull({table.employee_ID})
  or ({table.employee_ID}  <> previous({table.employee_ID})) then
   code1 := 'No'  //set the default value
else if {table.code} = 'code1' then
  code1 := 'Yes';  //set the value if it exists for this employee
code1
 
Create one of these for each code.  Put these formulas in columns next to the user name on your report.
 
-Dell
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.031 seconds.