Print Page | Close Window

dynamic column

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=13206
Printed Date: 20 Apr 2025 at 3:02pm


Topic: dynamic column
Posted By: sramkumarmca
Subject: dynamic column
Date Posted: 13 May 2011 at 10:52pm
Hi All,

I have two tables (sql server)

MainTable
---------
Emp_code BasicPay TotalAddition
------- -------- --------------
160       3000    200
161       4000    100

Additions Table
--------
emp_code     desc   trx_amount
----------   ---- --------
160        Bonus     100
160        Transport 100
161        Bonus      20
161        Transport 30
161        Food      50

My output report should be like this

Emp_code Basicpay Bonus transport Food TotalAddition(total of additions)
-------- --------- ------ --------- ------ -------------
160          3000    100        100 0      200
161           4000     20        30 50     100


Please suggest with this



Replies:
Posted By: lockwelle
Date Posted: 18 May 2011 at 3:39am
create variables to read the Additions table and to set the value for each possible column.  Run the formula in the detail section.  Suppress the detail section, as it doesn't fit the output desired.
 
display the values desired in the group footer.
 
use your formulas to pivot the data that is needed.
 
HTH


Posted By: Dewald
Date Posted: 02 Jun 2011 at 8:13pm

Create Formulas for Bonus, Transport and Food respectively.

the formulas should look something like this :

If desc = "Food" then

trx_amount

else

0

Add these formulas to the detail lines.

Create a Group on Emp_code and sum the formulas per group.

Suppress the Detail section.

This should work.

 



-------------
Dewald Botha
http://www.ITClarity.co.za



Print Page | Close Window