SAP Knowledge Base Article - Public

1290291 - How to show row numbers on a cross-tab in Crystal Reports?

Symptom

  • How to show a row number in a cross-tab?
  • Is it possible to show the rows or columns number on a cross-tab in Crystal Reports? 

Environment

  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
  • SAP Crystal Reports 2020 

Cause

  • There is no option in a cross-tab to show rows or columns number in Crystal Reports.

Resolution

  • A workaround to show rows or columns numbers on a cross-tab is to use a formula on the cross-tab, but the drawbacks are:
    • Row numbers for the row headers will display in decending order. ( For example: If there is 10 rows, it will show 10, 9, 8, 7... )
    • If the cross-tab span over multiple pages, the row numbers will reset on each page.
    • Row numbers for summaries will show in ascending order, but if there are multiple columns, the row number for the next column will equal to the total number of rows of the first columns plus one. 
        
  • Below are the general steps if the workaround on how to use a formula to show row numbers on a cross-tab:
       
    1. In Crystal Reports, create a report off any data source.
        
    2. Insert a Cross-Tab.
         
    3. To show the row numbers, right click on the row field header of the cross-tab, and select "Format Field..."
         
    4. In the "Format Editor" window, under the tab "Common", click on the "X-2" button of the option "Display String"
         
    5. In the "Formula Workshop", enter a code like:

         WhilePrintingRecords;
         NumberVar RowNumber;
         RowNumber:= RowNumber + 1;
         ToText(RowNumber,"##") + " - " + CurrentFieldValue;
             
    6. Save and close the Formula Editor.
        
    7. Back to the "Format Editor" click "OK" to accept the change.
         
      Same procedure can be followed to add numbers for the columns of the cross-tab.

Keywords

numbered list, cross tab numbering, CR, xtab, CrossTab , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020