Power of Cross-Tab functions in Crystal Reports 2008

I have not been a fan of Cross-tabs ever since I started to work with Crystal Reports version 7. I always like to to take time and design my reports in comfort and care them like my favorite bicycle i use to own. But anyways, we dont get luxury all the time to design the reports we want, specially when a quicker way of accomplishing it exists. When I use to see solution using cross-tabs, my thinking would be a) This may not be an important report and users just want to have some quicker and dirty solution and b) Developer is lazy to go extra mile and think of designing it in a nicer way.
Well, things have changed, evolved over the time and when I was working on a report recently (Crystal Reports 2008) which was earlier designed with cross-tab and we just needed few tweaks, conditional formatting and few other things which comes along those changes to be done, my initial reaction was to study this report and maybe come up with some better solution but then I remembered that SAP/BOBJ had mentioned about some cool features they have added to Cross-Tabs and started my mini journey on exploring these new functionality in cross-tabs.
When I started, I was skeptical and knew that we will hit dead end and come back to drawing board as some of these requirements cannot be done using Crystal Reports 2008 cross-tabs. You know what, I was wrong not for first time 🙂 though.
So, some of the functions I am going to list here and if I ever find time to record and edit with some doctored data, will post the video as well.
First challenge: Conditional formatting on Summarized field of cross tab, based on Summarized field value for a specific value in the row label
I am sure you might say that I over complicated and wrote the requirement, well that is what Blog is for, cannot write simple english :).
Anyways, lets clear it little more, if I have percentages showing in summarized field, I want to have colour formatting of font or background based on the numbers in the same column but only for a specific row value, for example ‘Target’. To do this, you can write conditional formula on the summarized field as below.
If
(
(GridValueAt(currentRowIndex, currentColumnIndex, currentSummaryIndex))

(GridValueAt(GetRowPathIndexOf(“Target”),currentColumnIndex,currentSummaryIndex))
) < 0

Then

crRed

Else If

(

 (GridValueAt(currentRowIndex, currentColumnIndex, currentSummaryIndex))

 – (GridValueAt(GetRowPathIndexOf(“Target”),currentColumnIndex,currentSummaryIndex)) ) > 0
Then
crBlue
Else
DefaultAttribute
**You can use the above formula in the format field of the ‘summarized field’ in the cross tab to get this working. There are many more functions and using in conjunction with this and highliting expert you can do wonders in cross-tab. Below is the entire list of functions which you could use in cross-tabs within Crystal Reports 2008 designer.

  • CurrentColumnIndex
    CurrentRowIndex
    CurrentSummaryIndex
    GetColumnGroupIndexOf (columnIndex)
    GetColumnPathIndexOf (columnPath)
    GetIndexOf (groupAlias, searchValue, (optional) startingIndex)
    GetNumColumnGroups
    GetNumColumns
    GetNumRowGroups
    GetNumRows
    GetNumSummaries
    GetRowGroupIndexOf (rowIndex)
    GetRowPathIndexOf (rowPath)
    GetTotalValueFor (groupAlias, (optional) summaryIndex)
    GridLabelAt (groupAlias, row/columnIndex)
    GridRowColumnValue (groupAlias, (optional) row/columnIndex)
    GridValueAt (rowIndex, columnIndex, summaryIndex)

You can search the Help of Crystal designer to get an example of the above functions. They are very self explanatory. Hope this bit of information on cross-tab will help some developer trying to resolve some of the things come with choosing to use cross-tab reporting. Happy SAP Crystal Reports Reporting 🙂

2 responses to “Power of Cross-Tab functions in Crystal Reports 2008”

  1. Minh Do says:

    I use Crosstab a lot but not to the extended of conditional formatting. These features are nice…will try them out.

  2. Marcel Moose says:

    Some truly quality blog posts on this website , bookmarked .

Leave a Reply

Your email address will not be published. Required fields are marked *