cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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,

Former Member
0 Kudos

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,

Accepted Solutions (0)

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor

Hi Anwar,

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

GetColumnGroupIndexOf(CurrentColumnIndex) = 0

-Abhilash

Former Member
0 Kudos

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

Former Member
0 Kudos

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,