Skip to Content
0

How i can create Calculated Columns Dynamically in Crosstab report CR 2013

Mar 05 at 07:43 AM

25

avatar image
Former Member

Hello All,

I have prepared crosstab report in Crystal Report 2013 as shown below and get year difference using calculate columns fields. But year difference not appeared when i change the input parameter and select other year. I need help to create calculated columns dynamically.

Report Criteria

Report Output

rptoutp.jpg

I used to below code in calculated columns to show year difference

Difference b/w 15 & 16

if GetColumnPathIndexOf({?Year}-3)= - 1 then 0 else if {?Year}>0 then -(GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-3), CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-2), CurrentSummaryIndex))

Difference b/w 15 & 17

if GetColumnPathIndexOf({?Year}-3)= - 1 then 0 else if {?Year}>0 then -(GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-3), CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-1), CurrentSummaryIndex))

Difference b/w 15 & 18

if GetColumnPathIndexOf({?Year}-3)= - 1 then 0 else if {?Year}>0 then -(GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-3), CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}), CurrentSummaryIndex))

Difference b/w 16 & 17

if GetColumnPathIndexOf({?Year}-2)= - 1 then 0 else if {?Year}>0 then -(GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-2), CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-1), CurrentSummaryIndex))

Difference b/w 16 & 18

if GetColumnPathIndexOf({?Year}-2)= - 1 then 0 else if {?Year}>0 then -(GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-2), CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}), CurrentSummaryIndex))

Difference b/w 17 & 18

if GetColumnPathIndexOf({?Year}-1)= - 1 then 0 else if {?Year}>0 then -(GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}-1), CurrentSummaryIndex) - GridValueAt(CurrentRowIndex, GetColumnPathIndexOf({?Year}), CurrentSummaryIndex))

Many thanks for any hint, much appreciated.

Best Regards,

rptcriteria.jpg (17.1 kB)
rptoutp.jpg (94.5 kB)
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Abhilash,

Thank you for your help. After your help, year is appearing dynamically but I am getting another issue while page navigation. Screen shot is as under:

Many thanks for any hint, much appreciated.

Best Regards,

cr2013.jpg (42.4 kB)
0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Abhilash Kumar
Mar 05 at 07:55 AM
1

Hi Anwar,

Right-click the Calculated Column's header cell > Select Calculated Member > Edit Insertion Formula > Use this code:

GetColumnGroupIndexOf(CurrentColumnIndex) = 0

-Abhilash

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thank you Abhilash and so nice of you. It works fine. Many many thanks. :)

0
Former Member

Hi Abhilash,

Thank you for your help. I am getting another issue while page navigation. Screen shot is as under:

Many thanks for any hint, much appreciated.

Best Regards,

cr2013.jpg (42.4 kB)
0