Print Page | Close Window

Adding Columns Bases on Database Records

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=4422
Printed Date: 28 Apr 2024 at 6:21pm


Topic: Adding Columns Bases on Database Records
Posted By: Ballou72
Subject: Adding Columns Bases on Database Records
Date 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?



Replies:
Posted By: hilfy
Date 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


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Ballou72
Date Posted: 03 Oct 2008 at 10:02am
Maximum of around 10


Posted By: Ballou72
Date Posted: 03 Oct 2008 at 10:02am

The extra codes would come in extra rows



Posted By: hilfy
Date 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:

mailto:%7b@Code1 - {@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


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window