Report Entity Example - Master/Detail Report

Using the report template created earlier, we will create a report listing open invoices by customer, with the customer information as the main block, and the open invoice information as a subsidiary block.

  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 OPEN_INVOICES 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. Leave the Default Mode property set to Parameter Form.   

  9. Leave the Body Style set to (from parent).

  10. Leave the Editable Field Style set to (from parent).

  11. Leave the Non- Editable Field Style set to (from parent).

  12. Leave the Lov Style set to (from parent).

  13. Leave the Link Style set to (from parent).

  14. Leave the Document Security set to Not Secure.

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

  16. In the Block Name property, enter CUSTOMERS as the name of the block.

  17. In the Block Type property, select Standard Block.

  18. Set the Query Type property to Simple Query.

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

  20. In the Table property, select the name of the table or view from which the data will be obtained.  Since our datasource is set to use the Oracle 9i database for NDS Applications, we will select the view CUSTMAST_VW.

  21. Leave the Create Heading checkbox set to off since we do not want a heading to be created for the block.

  22. In the Scheme Selection section, set the Form bullet to on since we want the labels and database fields displayed in the same block.

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

  24. The Adding Fields screen is displayed.  Select the columns that you wish to include in the report.

  25. Click on the name of the column to select both the Field and Label checkboxes for that column.  Do this for the following columns
    CITY
    CONTACT
    CONTACT_PHONE
    CUST_ADDR1
    CUST_NAME
    CUST_NO
    CUST_URL
    E_MAIL
    FAX_PHONE
    SLSMAN
    STATE
    TERMS_CD
    ZIP_CODE

  26. A key must be selected to continue.  Set the Key checkbox to on for the CUST_NO field as it is the key to this view.

  27. In the Filters property, you could enter code to restrict the data returned from the table.  We want to include only active customers for the user's logged in financial enterprise.

    where status_code = 'A' and org_unit_id = $$ORG_UNIT_ID$$

  28. In the Ordering and Grouping property, you can enter code to determine the order in which the data is displayed in the report.  We want the report to be ordered by customer name.

    order by cust_name

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

  30. The Ordering Fields screen is displayed next.  The columns are initially ordered as they were listed on the previous screen.  To move a field up or down, highlight the desired field by selecting it, and click on the Move Up or Move Down buttons on the right of the screen.  Move the fields until they are in the following order:
    CUST_NO
    CUST_NAME
    CUST_ADDR1
    CITY
    STATE
    ZIP_CODE
    CONTACT
    CONTACT_PHONE
    FAX_PHONE
    CUST_URL
    E_MAIL
    SLSMAN
    TERMS_CD

  31. Click on the Next button when you have finished moving the fields.

  32. The Option to Add More screen is displayed.  We need to create the detail block next.  Set the Add Block or Labels checkbox to on.  The entity in its current form will be displayed.  

  33. Expand the OPEN_INVOICES entity and select the CUSTOMERS block, as we are adding the detail block to this block..

  34. Click on the Add Block button at the bottom right of the screen.

  35. In the Block Name property, enter INVOICES as the name of the block.

  36. In the Block Type property, select Standard Block.

  37. Set the Query Type property to Simple Query.

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

  39. In the Table property, select the name of the table or view from which the data will be obtained.  Since our datasource is set to use the Oracle 9i database for NDS Applications, we will select the view ARINVSUM_VW.

  40. Leave the Create Heading checkbox set to off since we do not want a heading to be created for the block.

  41. In the Scheme Selection section, set the List bullet to on since we want the labels and database fields displayed in the separate blocks, with the labels at the top, and the database fields in a list below them.

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

  43. The Adding Fields screen is displayed.  Select the columns that you wish to include in the report.

  44. Click on the name of the column to select both the Field and Label checkboxes for that column.  Do this for the following columns
    CUR_BALANCE
    CUST_NO
    CUST_PO
    INVDATE
    INVNO
    INVOICE_TYPE

  45. A key must be selected to continue.  Set the Key checkbox to on for the CUST_NO field and the INVNO field as they are the keys to this view.

  46. Formatting can be applied to some of these fields.  In the Format column, select the following format masks for the following fields.
    CUR_BALANCE     #,###,###.00
    INVDATE                MM-dd-yyyy

  47. In the Filters property, you could enter code to restrict the data returned from the table.  We want to include only invoices that have not been paid in full for the user's logged in financial enterprise.

    where cur_balance <> 0 and org_unit_id = $$ORG_UNIT_ID$$

  48. In the Ordering and Grouping property, you can enter code to determine the order in which the data is displayed in the report.  We want the data on this block to be ordered by invoice number.

    order by invno

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

  50. The Ordering Fields screen is displayed next.  The columns are initially ordered as they were listed on the previous screen.  To move a field up or down, highlight the desired field by selecting it, and click on the Move Up or Move Down buttons on the right of the screen.  Move the fields until they are in the following order:
    INVNO
    CUST_PO
    INVDATE
    INVOICE_TYPE
    CUR_BALANCE
    CUST_NO

  51. Click on the Next button when you have finished moving the fields.

  52. The Create Join screen is displayed next.  If you need to create a join between a field in the master block and a field in the detail block that were named differently, this is where you would do it.  Since the join is on the CUST_NO field, and they are named the same in both the master and the detail blocks, you do not need to create a join here.  

  53. Click on the Next button to continue.

  54. The Option to Add More screen is displayed.  We need to add one more block for the parameter form. Set the Add Block or Labels checkbox to on.  The entity in its current form will be displayed.  

  55. Click on the OPEN_INVOICES entity to select it.  We need to add the block to the report itself.

  56. Click on the Add Block button.

  57. The Adding New Block screen is displayed.

  58. In the Block Name field, enter PARAMETER_FORM.

  59. Set the Block Type to Parameter Form.

  60. Set the Create Heading flag to on as we want an extra field on this block for a header.

  61. In the Editable Field Style pop-list, select DEFAULT_DATA_ENTRY.

  62. In the Non-Editable Field Style pop-list, select DEFAULT_STYLE.

  63. In the Body Style pop-list, select DEFAULT_STYLE.

  64. In the Link Style pop-list, select LINKS.

  65. Click on the Next button to continue.

  66. The Adding Fields screen is displayed next.  A field is displayed here for each of the database fields that were selected on the database block.

  67. Set the Include flag to on for the CUSTOMERS.CUST_NO field, as we want the report to be able to be restricted to a specific customer.

  68. Click on the Next button at the bottom of the screen to continue.

  69. The Ordering Fields screen is displayed Next.  Since we only have one field, there's nothing to order.

  70. Click on the Next button at the bottom of the screen to continue.

  71. The Option to Add More screen is displayed.  We need to add a label to the parameter form in order to run the report.  

  72. Set the Add Block or Labels flag to on.

  73. Expand the OPEN_INVOICES entity.

  74. Click on the PARAMETER_FORM block to select it.

  75. Click on the Add Labels button at the bottom of the screen.

  76. The Adding Labels screen is displayed.

  77. Click on the Add button to add a field to the section on the left.

  78. In the field, enter Run.

  79. Click on Next button at the bottom of the screen.

  80. The Option to Add More screen is displayed.

  81. We have no more blocks to add, so click on the Finish button.

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

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

  84. In the Explorer Tree, left click on the OPEN_INVOICES report entity and display the property sheet.

  85. In the Title property, enter the title for this report - Open Invoices by Customer

  86. All other settings come from the report template.  

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

  88. In the Contents property, enter the name of the new report - Open Invoices by Customer.

  89. Expand the PARAMETER_FORM block next.  

  90. Select the HEADING field.  In the Contents property, enter Open Invoice by Customer.

  91. In the Width field, enter 250.

  92. Select the CUST_NO field and display the property sheet.

  93. In the Display As property, select Option List.

  94. In the Option List of Values property, select the CUST_NO list of values that was created in the List of Values Examples section.

  95. In the Contents field, the global $$CUST_NO$$ is entered automatically.  This global is set on the execution of the report, and if the global exists, its value will be placed in this field the next time the report is run in the same session.

  96. In the Width field, enter 150.

  97. Scroll down on the property sheet and in the Target Column, the block and field that will be restricted by the value entered in this field on the parameter form is displayed.  This is the block and field that was selected during the block creation.

  98. Select the RUN field and display the property sheet.

  99. Set the Display As property to Button.

  100. Set the Field Style property to DEFAULT_BUTTON.

  101. In the Contents property, enter Run Report.

  102. Scroll down until you reach the On Mouse Click field.  Enter ExecuteReport();

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

  104. In the Explorer Tree, left click on the OPEN_INVOICES entity to select it.

  105. Right click to display the menu.  Select Designer Frame from the menu.

  106. The Designer Tool will be displayed containing the Parameter Form.  We need to modify the report itself.  

  107. In the pop-list in the upper right of the Designer Tool, select Run Report.

  108. The report will be displayed.

  109. 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.
     

  110. Hold down the Shift key and left click on the fields containing the text Cust No and CUS in the lower part of the report.  These are the customer number fields, which are also displayed in the upper block, and on which the two blocks are linked.  We do not need to display them in both blocks.  

  111. Double click on the CUS field to display the Multi-Select property sheet.

  112. Set the Visible property to false.

  113. Select the field that displays the text In.  This is the Invoice Type label.  In the Contents field, enter Typ.

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

  115. Modify the Contents field for the following labels.

    Labels

    Content

    Invno

    Invoice

    Invdate

    Inv Date

    Cur Balance

    Current Bal

  116. In order to fit all of the information in the following fields, they need to be expanded a bit.  Expand and lay out the fields in the lower block so that they look like:

  117. 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.

  118. Since a global variable was defined in the Filtering property, you must define the value before the screen is run.  Enter 100 in the value field and press the Run button.

  119. The parameter screen will be run in the browser.

  120. Select the desired customer from the Cust No option list and press the Run Report button.  If you leave the field set to (not selected), the report will include all customers.

  121. The report will be generated and displayed on the screen.

  122. Additional modifications can be made in the Designer Tool for layout and text changes using the learned functionality.

Xephr is a registered trademark of NDS Systems, LC.

Copyright © 2007 NDS Systems LC.