Screen Entity Example - Editable Lists

In this example, we will create a screen entity with a list of records that are editable.  In the Master/Detail Screen example, the CONTACTS block was also created as an editable list in the CUSTOMER_ACTIVITY screen.

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

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

  3. Click on the Screen bullet.

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

  5. In the Entity Name property, type TERRITORIES 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 SCREEN_TEMPLATE, which is the template that we created earlier.

  8. Leave the Default Mode property set to QBE View.   

  9. Leave the Body Style, Editable Field Style, Non-Editable Field Style, Lov Style and Link Style properties set to (from parent), as these styles will be taken from the SCREEN_TEMPLATE for this screen.

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

  11. In the Block Name property, enter TERRITORY as the name of the block.

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

  13. Set the Query Type property to Simple Query.

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

  15. 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 TERRITORY_CODE_UVW.

  16. Set the Create Heading checkbox to on to indicate that a heading should be created for each mode for this block.

  17. In the Mode Selection section, set the QBE and List checkboxes to on..  We will be creating 2 blocks for this screen.  

    The first block is the query block for the QBE and List screens, which allows users to query territories.  
    The second block is the List block, which displays a list of territories based on the entries on the query block.

  18. In the Scheme Selection section, leave the Form bullet set to on, since this is the main block, and we will be viewing one record at a time.

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

  20. The Adding Fields screen is displayed.  Select the columns that you wish to include on the screen.

  21. Click on the Field label and the Label label at the top of the columns to select all columns:

  22. Left click on the ORG_UNIT_ID column to set all the flags to off for this field, since we will not be displaying it on the query block.

  23. A key must be selected to continue.  Set the Key checkbox to on for the ORG_UNIT_ID field and the TERRITORY field as they are the keys to this view.

  24. Since this block is not returning data from the database, we do not need to make entries in the Filters or Ordering and Grouping fields for this block.

  1. Click on the Next button at to the bottom of the screen.

  2. 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:
    TERRITORY
    DESCRIPTION
    LOCAL_FLAG
    ORG_UNIT_ID

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

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

  5. Since we are adding the next block to the main screen entity, select the TERRITORIES entity.

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

  7. The List block should be named the same as the query block, because the ExecuteQbe() javascript command that takes us from query mode to list mode and restricts the data displayed in the list mode to that which meets the criteria on the query screen requires it.

  8. In the Block Name property, enter TERRITORY as the name of the block.

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

  10. Set the Query Type property to Simple Query.

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

  12. 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 TERRITORY_CODE_UVW.

  13. Set the Create Heading checkbox to on to indicate that a heading should be created for each mode for this block.

  14. In the Mode Selection section, set the QBE checkbox to off and the List checkbox to on, as we are creating the block to list the data returned from the database.

  15. In the Scheme Selection section, set the List bullet to on, since multiple records are being returned to this screen and we wish to have the labels displayed at the top of the screen and the fields displayed below them.

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

  17. The Adding Fields screen is displayed.  Select the columns that you wish to include on the screen.

  18. Click on the Field label and the Label label at the top of the columns to select all columns:

  19. Left click on the ORG_UNIT_ID column to set all the flags to off for this field, since we will not be displaying it on the list block.

  20. A key must be selected to continue.  Set the Key checkbox to on for the ORG_UNIT_ID field and the TERRITORY field as they are the keys to this view.

  21. In the Filters property, you could enter code to restrict the data returned from the table.  We only want to view territory records for the user's logged in enterprise, so enter the following filter:

    where org_unit_id = $$ORG_UNIT_ID$$

  22. In the Ordering and Grouping property, you can enter code to determine the order in which the data is displayed in the screen.  We want the territories to be listed in alphabetical order by territory code, so the following should be entered:

    order by territory

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

  24. 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:
    ORG_UNIT_ID
    TERRITORY
    DESCRIPTION
    LOCAL_FLAG

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

  26. The Option to Add More screen is displayed.  We have no more blocks to create.  Click on the Finish button at the bottom of the screen.

  27. The new entity is added to the initially selected group.  In the Explorer Tree, the new entity will be displayed, expanded with all blocks shown.

  28. Click on the Save button in the main toolbar to save the new screen entity.

  29. Right click on the TERRITORIES entity and select Designer Frame from the menu.

  30. Within the Designer Tool, you can move, align, and resize the objects.  For specific instructions on the Designer Tool and its functionality, see the Designer Tool section.

  31. When the Designer Tool is displayed, expand it so that you can see the entire entity.  The Designer Tool displays the default mode of the entity selected.  The pop-list in the upper right of the Designer Tool indicates that we are viewing the lay out of the QBE View.

  32. Left click on the field that displays the word TERRITORY to select it and double click to display the property sheet.  This is the HEADING field for the QBE screen.

  33. In the Contents property, enter the text Search Territory Codes.

  34. The TERRITORY field needs to be uppercase.  Left click on the field that displays the word TER... and double click to display the property sheet.

  35. Set the Text Case property to Uppercase.

  36. The LOCAL_FLAG field needs to be set as a checkbox field instead.  Left click on the field that displays the word LOCAL_FLAG and double click to display the property sheet.

  37. Set the Displays As property to Checkbox.

  38. In the YES Value property, enter Y.

  39. In the NO Value property, enter N.

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

  41. You have completed the changes for this screen in QBE Mode.  Now we will move onto List Mode.

  42. In the pop-list in the upper right corner of the Designer Tool, select List View.

  43. We need to modify the LEFT_MENU block to remove the link to the New screen, since we have no New mode for this screen.  Also, since the list screen is an editable list, meaning it allows records to be inserted and updated, we need to add the Save link.

  44. In the Explorer Tree, expand the LEFT_MENU block and left click on the SAVE field to select it.  Double click to display the property sheet.

  45. Set the On List property to true.

  46. Left click on the NEW field to select it and display the property sheet.

  47. Set the On QBE, On List, and On Edit flags to false for this field.

  48. On the Designer Tool, you can see the newly added Save link.

  49. Left click on the field that displays the word TERRITORY_HEADER to select it and double click to display the property sheet.  This is the HEADING field for the List screen.

  50. In the Contents property, enter the text Maintain Territory Codes.

  51. The LOCAL_FLAG field needs to be set as a checkbox.  Left click on the field that displays LOCAL_FLAG and double click to display the property sheet.

  52. In the Default Value field, enter N.  We want this field to default to N if no entry is made for a new record.

  53. Set the Displays As property to Checkbox.

  54. In the YES Value property, enter Y.

  55. In the NO Value property, enter N.

  56. The Territory, Description, TERRITORY, and DESCRIPTION fields need to be made larger and marked as required.  Also, the TERRITORY field needs to be upper case.

  57. In order to make sure that there is enough room to make the fields larger, we need to move the other fields to the right.  Move the fields around until they look like this:

  58. Drag the edges of fields until they look like this.  You are doing this for the Territory, Description, TERRITORY, and DESCRIPTION fields:

  59. Left click on the TERRITORY field and double click to display the property sheet.

  60. Set the Required property to true.

  61. In the Tool Tip property, enter Territory.

  62. Set the Text Case property to Uppercase.

  63. Left click on the DESCRIPTION field and double click to display the property sheet.

  64. Set the Required property to true.

  65. Set the Tool Tip property to Description.

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

  67. In the Explorer Tree, we need to modify the ORG_UNIT_ID field to have a default value.  We want it to be filled in automatically with the user's org unit id .  Left click on the ORG_UNIT_ID field and display the property sheet.

  68. In the Default Value field, enter $$ORG_UNIT_ID$$.

  69. We need to set up the list block to allow the entry of new records.

  70. Left click on the TERRITORY block and double click to display the property sheet.

  71. We only want the editable list to display 50 records, in order to save load time.  In the Max Number of Rows field, enter 50.  

    The initial value is 0, which indicates that the default number of 200 will be used.

  72. We want the new rows to be displayed at the top of the list, se set the New Rows First property to true.

  73. We want two new rows to display.  In the Num New Rows property, enter 2.

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

  75. To test the new screen entity, highlight it by selecting it, and click on the Run button in the main toolbar.

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

  77. The screen will be run in the browser.

Xephr is a registered trademark of NDS Systems, LC.

Copyright © 2007 NDS Systems LC.