Screen Entity Example - Master/Detail Screen

Using the screen template created earlier, we will create a customer contact screen with the customer information as the main block, and the contact 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 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 CUSTOMER_ACTIVITY as the entity name.

  6. Leave the Datasource property set to (use default).

  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 right of the screen.

  11. In the Block Name property, enter CUSTOMERS 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 CUSTMAST_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 3 different blocks for this screen, one for each mode.  

    The first block is the query block for the QBE and List screens, which allows users to query customers.  
    The second block is the List block, which displays a list of customers based on the entries on the query block.
    The third block is the Edit block, which displays a single customer selected from the list block, and that customer's associated information.

  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 name of the column to select both the Field and Label checkboxes for that column.  Do this for the following columns
    CITY
    COUNTRY
    CUST_ADDR1
    CUST_ADDR2
    CUST_ADDR3
    CUST_NAME
    CUST_NO
    STATE
    ZIP_CODE

  22. A key must be selected to continue.  Set the Key checkbox to on for the CUST_NO and ORG_UNIT_ID fields as they are the keys to this view.

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

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

  25. 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
    CUST_ADDR2
    CUST_ADDR3
    CITY
    STATE
    COUNTRY
    ZIP_CODE
    ORG_UNIT_ID

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

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

  28. Since we are adding the next block to the main screen entity, select the CUSTOMER_ACTIVITY entity.

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

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

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

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

  33. Set the Query Type property to Simple Query.

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

  35. 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_UVW.

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

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

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

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

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

  41. Click on the name of the column to select both the Field and Label checkboxes for that column.  Do this for the following columns
    CUST_ADDR1
    CUST_NAME
    CUST_NO

  42. A key must be selected to continue.  Set the Key checkbox to on for the CUST_NO and ORG_UNIT_ID fields as they are the keys to this view.

  43. In the Filters property, you could enter code to restrict the data returned from the table.  We want to include all active customers for the user's current enterprise, so enter the following filters:

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

  44. 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 customers to be listed in alphabetical order by customer name, so the following should be entered:

    order by cust_name

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

  46. The Ordering Fields screen is displayed next.  The columns are initially ordered as they were listed on the previous screen.  For blocks using the list scheme, this determines the left to right order of the fields in the list.  The first field is placed on the far left, and each field after is placed to the immediate right of the previous field.  When there is no more room left on the block, the fields are moved down to the next row and placement starts over at the far left..
    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
    ORG_UNIT_ID

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

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

  49. Since we are adding the next block to the main screen entity, select the CUSTOMER_ACTIVITY entity.

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

  51. There will be two blocks on the edit block.  The first block is the parent block, and it will contain the customer information, and should look just like the query block.  The child block will contain the customer contact information, and will be added a little later in this example.

  52. Set the Create block similar to pop-list to the CUSTOMERS (qbe,list) block.   This will set up the block to be the same as the earlier created qbe/list block.  Then, we can just modify the properties for the Edit block.

  53. In the Block Name property, enter CUSTOMERS as the name of the block.  Although it is not necessary to name the edit block the same as the query and list block, it gives consistency to the page.

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

  55. In the Mode Selection section, set the QBE and List checkboxes to off and the Edit checkbox to on, as we are creating the block to display a single record from the database that will be selected from the List block.

  56. In the Scheme Selection section, leave the Form bullet to on, since a single record will be displayed on this screen, and the labels and fields will be contained within the same block.

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

  2. The Adding Fields screen is displayed.  You'll notice that there are fields already selected.  These are the fields selected earlier on the qbe/list screen.  We need to add to this information for the edit screen.

  3. Verify that the following columns are selected:
    CITY
    COUNTRY
    CUST_ADDR1
    CUST_ADDR2
    CUST_ADDR3
    CUST_NAME
    CUST_NO
    STATE
    ZIP_CODE

  4. A key must be selected to continue.  Verify that the Key checkbox is set to on for the CUST_NO and ORG_UNIT_ID fields as they are the keys to this view.

  5. Since this block is accessed through the list screen, and is passed restrictions through that link, we do not need to make entries in the Filters or Ordering and Grouping fields for this block.

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

  7. The Ordering Fields screen is displayed next.  The columns are initially ordered as they were ordered on the qbe/list screen from which this block definition was copied.  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.  Verify that the fields are in the following order:
    CUST_NO
    CUST_NAME
    CUST_ADDR1
    CUST_ADDR2
    CUST_ADDR3
    CITY
    STATE
    COUNTRY
    ZIP_CODE
    ORG_UNIT_ID

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

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

  10. Expand the CUSTOMER_ACTIVITY entity and select the CUSTOMERS (edit) block, as we are only adding the contact information to the edit screen.

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

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

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

  14. Set the Query Type property to Simple Query.

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

  16. 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 CONTACT_MASTER_UVW.

  17. Set the Create Heading checkbox to on to indicate that a heading should be created this block.

  18. In the Scheme Selection section, set the List bullet set to on, since this is the secondary block, and multiple contacts will exist for a single parent customer record.

  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 in the block.

  21. Click on the name of the column to select both the Field and Label checkboxes for that column.  Do this for the following columns
    CONTACT
    E_MAIL

  22. A key must be selected to continue.  Set the Key checkbox to on for the CUST_NO and CONTACT_ID fields.  The CONTACT_ID field is a key to the view, and we want to link the subsidiary record to the customer record using the CUST_NO field.

  23. In the Filters property, you could enter code to restrict the data returned from the table.  We want to include only contacts that are defined as customer contacts, so we enter the following restriction

    where cust_contact = 'Y'

  24. 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 customer's contact information to be displayed in alphabetical order by contact name, so the following should be entered:

    order by contact

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

  26. 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:
    CONTACT
    E_MAIL
    CONTACT_ID
    CUST_NO

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

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

  29. The Option to Add More screen is displayed.  We have no more blocks to add, so click on the Finish button.

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

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

  32. Now we need to make sure that the correct links are showing up on each mode for this screen.

  33. Right click on the CUSTOMER_ACTIVITY entity in the Explorer Tree and select Designer Frame from the menu.

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

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

  36. Left click on the field that contains the word CUSTOMERS.  This is the heading for this block in QBE Mode.  Double click to display the property sheet.

  37. In the Contents property, enter the text: Search Customers.

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

  39. Some of these fields need to be restricted to upper case, because the data contained in the database is upper case only.

  40. Hold down the Shift key, and in the Designer Tool, select the CUST_NO, STATE, COUNTRY, and ZIP_CODE fields by left clicking on them.

  41. Double click on the ZIP_CODE field to display the property sheet that allows you to modify all four fields at the same time.

  42. Set the Text Case property to Uppercase.

  43. We can delete two of the three address labels. Hold down the Shift key, and in the Designer Tool, select the Cust Addr2 and Cust Addr3 fields by left clicking on them.

  44. Click on the Delete Current button in the main toolbar to delete the fields.

  45. The Confirm Delete pop-up is displayed.  Click on the Yes button.

  46. The Delete Results pop-up is displayed.  Click on the Ok button.

  47. Repeat for the Cust Addr3 pop-ups.

  48. We need to change the text in the Cust Addr1 label.  Left click on the Cust Addr1 label and display the property sheet.

  49. In the Contents property, type Address.

  50. We need to assign a list of values to the CUST_NO field.  Left click on the CUST_NO field to select it and display the property sheet.

  51. In the List of Values property, select CUST_NO.

  52. Set the Enforce Lov property to false, since this is a query screen, and they should be able to enter partial queries.

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

  54. You have complete the change for this screen in QBE Mode.  Now we will move onto List Mode.

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

  56. First, we need to move the list block so that it is below the query block. In the Designer Tool, click to the right of the CUST_ADDR1 field to select the block.

  57. Then click on the Select Parent button in the toolbar at the top of the Designer Tool.  This selects the top level container.

  58. Now we need to make the parent block just a little bigger, so that we can move it around in the Designer Tool.  Hover your cursor over the bottom edge of the block until it turns into a double headed arrow.  Hold down your left mouse button and drag the edge of the block down.

  59. Now left click in the space that was created.  Hold down the mouse button, and drag the block down so that it's below the query block.

  60. The list screen should be Display Only, so first, we will mark the database block display only.

  61. In the Designer Tool, left click in the blank area to the right of the CUST_ADDR1 field to select the CUSTOMERS block.  Double click to display the properties sheet.

  62. Set the Display Only property to true.

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

  64. In the Designer Tool, left click on the field that reads CUSTOMERS_HEADER, which is the heading for the block.  Double click to display the property sheet.

  65. For the Contents property, enter the text List of Customers.

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

  67. You have complete the change for this screen in List Mode.  Now we will move onto Edit Mode.

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

  69. Some of the left menu links are inappropriate for Edit mode.  Hold Shift down, and select the following links on the left menu:  New and Delete.
    New
    link because we did not create a new block for this screen, so we do not want users to have access to the screen in New mode.
    Delete
    link because we only want the user to be able to modify the customers and contacts, but not delete them from the database.

  70. Double click on the Delete link to display a property sheet that allows you to modify both links at once.  

  71. Set the On Edit property to false.

  72. The left menu will now look like this:

  73. Left click on the field that contains the word CUSTOMERS.  This is the heading for this block in Edit Mode.  Double click to display the property sheet.

  74. In the Contents property, enter the text: Maintain Customers.

  75. Some of these fields need to be restricted to upper case, because the data contained in the database is upper case only.

  76. Hold down the Shift key, and in the Designer Tool, select the CUST_NO, STATE, COUNTRY, and ZIP_CODE fields by left clicking on them.

  77. Double click on the ZIP_CODE field to display the property sheet that allows you to modify all four fields at the same time.

  78. Set the Text Case property to Uppercase.

  79. A few modifications need to be made in the lower block as well.  In the Explorer Tree, complete the following steps.

  80. Left click on the field that contains the word CUSTOMER_CONTACTS.  This is the heading for this block in Edit Mode.  Double click to display the property sheet.

  81. Select the HEADING label.  Double click to display the property sheet.

  82. In the Contents property, enter the text: Contacts.

  83. Select the CONTACT field.  It was assigned an automatic hyperlink because it is on a list format block, and it was the first field when we were ordering the fields during block creation.  We need to remove the hyperlink and make the field editable.

  84. Display the property sheet. In the Hyperlink To property, clear the entry.  

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

  86. We want users to be able to enter new contacts for customers as well.  Click on the CUSTOMER_CONTACTS block in the Explorer Tree and display the property sheet.

  87. Change the Num New Rows property to 1.

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

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

  90. The Preparing to Run screen is displayed.  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.

  91. The screen will be run in the browser.

Xephr is a registered trademark of NDS Systems, LC.

Copyright © 2007 NDS Systems LC.