Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: dynamic column Post Reply Post New Topic
Author Message
sramkumarmca
Newbie
Newbie


Joined: 01 May 2011
Online Status: Offline
Posts: 5
Quote sramkumarmca Replybullet Topic: dynamic column
    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
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet 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
IP IP Logged
Dewald
Groupie
Groupie
Avatar

Joined: 02 Jun 2011
Location: South Africa
Online Status: Offline
Posts: 47
Quote Dewald Replybullet 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
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.