Charts as Reports Example

Using the report template created earlier, we will create a report displaying a chart of sales versus cost by period.

See Also

Chart Blocks

Creating a Report with a Chart

  1. Select the Group Information object.  Expand it, and select the group to which you wish to add the new report entity.

  2. Right click on the group and select Create ->Entity.

  3. Click on the Report bullet.

  4. Click on the Next button at the bottom right of the screen.

  5. In the Entity Name property, type REPORT_WITH_CHART as the entity name.

  6. Leave the Datasource property set to (use default), since there is only one datasource for the Xephr® install.

  7. In the Based On property, select REPORT_TEMPLATE, which is the template that we created earlier.

  8. Set the Default Mode property to Run Report.   

  9. Leave the Body Style, Editable Field Style, Non - Editable Field Style, Lov Style, and Link Style set to (from parent).

  10. Leave the Document Security set to Not Secure.

  11. Click on the Next button at the bottom right of the screen.

  12. In the Block Name property, enter CUST_HIST as the name of the block.

  13. In the Block Type property, select Chart Block.

  14. Set the Query Type property to Complex Query.

  15. Leave the Datasource property set to (use parent).

  16. In the Chart Type pop-list, select Bar Chart.

  17. In the Chart Title property, enter Sales vs Cost.

  18. Leave the Create Heading property set to off.

  19. Click on the Next button at the bottom right of the screen.

  20. The Setting Complex Query properties screen is displayed.

  21. When the Query Type is Complex Query for any block, you must enter the select statement, filters, and ordering and grouping information manually, defining the columns to be selected and the table from which the columns will be selected.  

  22. In the Select Statement property, enter

    select year_month, sum(sls_cost) sls_cost, sum(sls_rev) sls_rev from cust_hist_mo_dtl

  23. In the Filters property, to have only periods from 2003 displayed, enter

    where year_month like '2003%'

  24. In the Ordering and Grouping property, enter

    group by year_month
    order by year_month

  25. Click on the Next button on the bottom right of the screen to continue.

  26. The Adding Fields screen is displayed, including the columns defined in the complex query.  Select the columns that you wish to include in the chart.

  27. For charts, to include a column in the chart, set the Key checkbox to on.  Do this for all columns displayed.

  28. For each column, in the Used As property, you must define how the column will be used when generating the chart.
    For the YEAR_MONTH column, select Datapoint Label.  This is the column that is the key to the chart, for which the values are measured.  The values in this column are used to label each bar.
    For the SLS_COST and SLS_REV columns, select Datapoint Value.   These are the measured values that determine the height of the bars.

  29. Click on the Next button at the bottom right of the screen.

  30. The Option to Add More screen is displayed.  We do not need to add any additional blocks. so click on the Finish button.

  31. The new entity is added to the initially selected group.  

  32. Click on the Save button in the main toolbar to save the new report entity.

  33. In the Explorer Tree, left click on the REPORT_WITH_CHART report entity and display the property sheet.

  34. In the Title property, enter the title for this report - Sales vs Cost by Period.

  35. All other settings come from the report template.  

  36. Expand the HEADER_BLOCK block next, select the HEADER_TEXT field, and display the property sheet.

  37. In the Contents property, enter the name of the new report - Sales vs Cost by Period.

  38. Click on the Save button in the main toolbar to save the changes.

  39. Right click on the CUST_HIST block and select Designer Frame from the menu.

  40. Expand the Designer Tool to display the entire report.

  41. Notice that the report title is too small to display all of the words.  Left click on the field to select it.  Then, hold your cursor over the right edge of the field until it turns into a double headed arrow.  Left click, hold down the mouse button, and drag the edge to the right until the field displays all the words.

     

  42. The CUST_HIST block needs to be expanded a little so that it will display the chart properly.  Left click on the block to select it.  In the same way as you expanded the report title, we are going to expand this block.  Hold your cursor over the bottom edge of the chart until it turns into a double-headed arrow.  Left click, hold down the mouse button, and drag the edge down until it looks like it's big enough.



  43. Click on the Save button in the main toolbar to save the changes.

  44. To test the new report entity, highlight it by selecting it in the Explorer Tree, and click on the Run button in the main toolbar.

  45. The Preparing to Run pop-up screen is displayed.  Click on the Run button.

  46. The report is generated and displayed on the screen.

Xephr is a registered trademark of NDS Systems, LC.

Copyright © 2007 NDS Systems LC.