Creating Reports with Groups and Summary Fields


Concept


Steps:

  1. Begin by creating a new report using the New button.

     

    Click the New button.

    Step 1
  2. Use the Crystal Reports Gallery dialog box to define whether you are creating a new report using the Report Wizard or as a blank report.

    Step 2
  3. Click the As a Blank Report option.

    Step 3
  4. Click the OK button.

    Step 4
  5. Use the Database Expert dialog box to view a list of databases that are available for you to use when creating reports for query data or other applications.

    Step 5
  6. In this example, you will open the UNIT1 query under the Current Connections folder.

     

    Double-click the Current Connections list item.

    Step 6
  7. Double-click the QUERY list item.

    Step 7
  8. Press the left mouse button and drag the mouse to select the desired text.

    Step 8
  9. Release the mouse button.

    Step 9
  10. Click the UNIT1 list item.

    Step 10
  11. Click the Move Right button.

    Step 11
  12. Click the OK button.

    Step 12
  13. Use the Design window to create professional looking reports.

    Step 13
  14. Use the Field Explorer button to open the Field Explorer for you to insert database fields.

     

    Alternatively, select View, Field Explorer on the menu bar.

    Step 14
  15. In this example, you will open Field Explorer using the Field Explorer button.

     

    Click the Field Explorer button.

    Step 15
  16. Use the Field Explorer to insert, modify, or delete fields on the Design and Preview windows of Crystal Reports.

    Step 16
  17. Use the Database Fields branch of the tree to add database fields to your report.

     

    Fields are listed by table.

    Step 17
  18. Double-click the Database Fields list item.

    Step 18
  19. Double-click the UNIT1 list item.

    Step 19
  20. Use one of these methods to insert multiple fields into a report:

    •  SHIFT + Click.

        Use this combination to select a continuous range of adjacent fields.

    •  CTRL + Click.

        Use this combination to select multiple fields from the database field listing that are not adjacent to one another.

    Step 20
  21. In this example, you insert all fields in to the Details section of the report using the SHIFT + Click combination.

     

    Click the DESCR list item.

    Step 21
  22. Press the [Shift] key and click the TRAINING_UNITS list item.

    Step 22
  23. Press the left mouse button and drag the mouse to select the desired text.

    Step 23
  24. Release the mouse button.

    Step 24
  25. In this example, you will highlight all headers and change their formats to bold.

     

    Press the left mouse button and drag the mouse to select the desired text.

    Step 25
  26. Release the mouse button.

    Step 26
  27. Click the Bold button.

    Step 27
  28. In this example, you click outside of the headings to deselect the headings.

     

    Click the blank space.

    Step 28
  29. Double-click in the DESCR field.

    Step 29
  30. In this example, you will change the DESCR column heading to Company.

     

    Enter the desired information into the DESCR field. Enter

     "Company"
    .

    Step 30
  31. Double-click in the CUSTOMER_TYPE field.

    Step 31
  32. In this example, you will change the CUSTOMER_TYPE column heading to Customer Type.

     

    Enter the desired information into the CUSTOMER_TYPE field. Enter

     "Customer Type"
    .

    Step 32
  33. Double-click in the CONTRACT_DT field.

    Step 33
  34. In this example, you will change the CONTRACT_DT column heading to Contract Date.

     

    Enter the desired information into the CONTRACT_DT field. Enter

     "Contract Date"
    .

    Step 34
  35. Double-click in the TRAINING_UNITS field.

    Step 35
  36. In this example, you will change the TRAINING_UNIT column heading to Training Unit.

     

    Enter the desired information into the TRAINING_UNIT field. Enter

     "Training Unit"
    .

    Step 36
  37. Use the Special Fields to insert information such as Page Numbers, Print DateReport Comments, and so on.

    Step 37
  38. Double-click the Special Fields list item.

    Step 38
  39. In this example, you will drag the Report Title special field to the middle of the Report Header section.

     

    Press the left mouse button and drag the mouse to select the desired text.

    Step 39
  40. Step 40

  41. Click the Bold button.

    Step 41
  42. Use the Save button to save reports.

     

    Alternatively, select File, Save on the menu bar.

    Step 42
  43. In this example, you will save the report using the Save button.

     

    Click the Save button.

    Step 43
  44. In this example, you will access the Document Properties dialog box using the File, Summary Info menu.

     

    Click the File menu.

    Step 44
  45. Click the Summary Info list item.

    Step 45
  46. Use the Document Properties dialog box to document report properties.

    Step 46
  47. In general, you should complete these important fields in the Document Properties dialog box: Author, Comments, Keywords, and Title.

     

    In this example, you will document only the Title field, so it is used in the Report Title special field.

     

    Click in the Title field.

    Step 47
  48. In this example, you will enter Customer Summary Information as title.

     

    Enter the desired information into the Title field. Enter

     "Customer Summary Information"
    .

    Step 48
  49. Click the OK button.

    Step 49
  50. In this example, you will save the report using the File, Save As menu.

     

    Click the File menu.

    Step 50
  51. Click the Save As list item.

    Step 51
  52. Use the Save As dialog box to name the report and to navigate to the folder where you want to store the report.

    Step 52
  53. Click in the File name field.

    Step 53
  54. In this example, you enter Customer Summary Information.rpt as file name.

     

    Enter the desired information into the File name field. Enter

     "Customer Summary Information.rpt"
    .

    Step 54
  55. Click the Save button.

    Step 55
  56. Use the Print Preview button to preview reports in the Preview window.

     

    Alternatively, select File, Print Preview on the menu bar.

    Step 56
  57. In this example, you will preview the report using the Print Preview button.

     

    Click the Print Preview button.

    Step 57
  58. Use the Preview window to preview the results of reports.

    Step 58
  59. Use the Group Expert button to specify how fields are grouped on your report.

     

    Alternatively, select Report, Group Expert on the menu bar.

    Step 59
  60. In this example, you will access the Group Expert dialog box using the Report, Group Expert menu.

     

    Click the Report menu.

    Step 60
  61. Click the Group Expert list item.

    Step 61
  62. Use the Group Expert dialog box to specify how fields will be grouped on your report.

    Step 62
  63. Use the Available Fields list to view all of the fields available for use in grouping.

     

    This list is based on the report fields you chose in the Field Explorer and the tables you selected on the Database Expert dialog box.

    Step 63
  64. Use the Group By list to view all of the fields you've selected for grouping. As you add fields, they are added in a hierarchy. This hierarchy establishes the order the groups will appear in the report.

    Step 64
  65. Click the UNIT1.CONTRACT_DT list item.

    Step 65
  66. Click the Move Right button.

    Step 66
  67. Use the Options button to access the Change Group Options dialog box.

    Step 67
  68. Click the Options button.

    Step 68
  69. Use the Change Group Options dialog box to edit the criteria that are used for triggering and sorting groups.

    Step 69
  70. Click the down arrow next to the The section will be printed field.

    Step 70
  71. Click the for each year list item.

    Step 71
  72. Click the OK button.

    Step 72
  73. Click the OK button.

    Step 73
  74. Click the Save button.

    Step 74
  75. Use the Insert Summary button to access the Insert Summary dialog box, where you can summarize data and print the summary in your report.

     

    Alternatively, select Insert, Summary on the menu bar.

    Step 75
  76. In this example, you will access the Insert Summary dialog box using the Insert, Summary menu.

     

    Click the Insert menu.

    Step 76
  77. Click the Summary list item.

    Step 77
  78. Use the Insert Summary dialog box to summarize the data in a field in your report. You can insert summaries, subtotals, and grand totals while using this dialog box.

    Step 78
  79. Use the Choose the field to summarize field to determine the field on which to perform the calculations.

    Step 79
  80. Click the down arrow next to the Choose the field to summarize field.

    Step 80
  81. Click the UNIT1.TRAINING_UNITS list item.

    Step 81
  82. Use the Calculate this summary field to determine a summary operation to use in the report.

     

    Note that not all summary types are available to all fields. For example, you cannot average two-character fields.

    Step 82
  83. Click the down arrow next to the Calculate this summary field.

    Step 83
  84. Click the Sum list item.

    Step 84
  85. Use the Summary location field to determine the location of the summary.

     

    By default, Grand Total is a summary field in the report.

    Step 85
  86. Click the down arrow next to the Summary location field.

    Step 86
  87. Click the Group #1: UNIT1.CONTRACT_DT list item.

    Step 87
  88. Click the OK button.

    Step 88
  89. Click the Design tab.

    Step 89
  90. Use the Insert Text Object button to insert a text object anywhere on your report.

     

    Alternatively, select Insert, Text Object on the menu bar.

    Step 90
  91. In this example, you will insert a text object into Group Footer #1 section using the Insert, Text Object menu.

     

    Click the Insert menu.

    Step 91
  92. Click the Text Object list item.

    Step 92
  93. Step 93

  94. Enter the desired information into the Text Object field. Enter

     "Training Unit Summary:"
    .

    Step 94
  95. Click the Bold button.

    Step 95
  96. Click the Save button.

    Step 96
  97. Click the Preview tab.

    Step 97
  98. The Customer Summary Information report displays the training unit summary for each year.

    Step 98

You have successfully created a report with groups and summary fields.

Table of Contents  Start Topic