Geeks With Blogs
CodeSeeker Just another developer trying to do the right thing

The requirement is to show a Find dialog to the user along with a Find button so that the user must perform a search for a record before they are allowed to enter a new one. Once the user clicks the Find button, an "Add New" button is made visible. Upon clicking the "Add New" button, the Find dialog is hidden altogether and an Add dialog is displayed. In ExtraView, this is all done within an Add layout.

Setup

  1. The Add screen on which this is occurring should only contain the 2 layouts: one for the Find dialog, and one for the Add dialog. We will call this the parent Add screen.
  2. The Find dialog contains a search layout which contains the Find button, and an Add New button, which is a simple, user-defined Custom field with the _BUTTON or _BTN suffix.
  3. In addition, a "Return to Find Dialog" button can be added to the Add dialog to switch the user's view back to the Find dialog only.

Layout Cell Attributes

  1. Create 2 data dictionary user-defined text fields to act as visibility flags: one for the Add New button and one for the Find dialog. Let's call them FIND_DIALOG_FLAG and ADD_BUTTON_FLAG. (There are no special properties to the _FLAG suffix -- it's only a naming convention.) Their default value should be 1.
  2. Place the Find dialog flag field on the parent Add screen. Add the following layout cell attributes:
    1. VISIBLE_IF ID# equals -99. This ensures the flag will never be visible. For debugging, you may want to make the field visible by removing this attribute.
  3. Place the Add Button flag field on the Find dialog and apply the same attribute as above.
  4. On the parent Add screen, apply the following attribute to the Find dialog layout:
    1. VISIBLE_IF FIND_DIALOG_FLAG equals 1
  5. On the parent Add screen, apply the following attribute to the Add dialog:
    1. VISIBLE_IF FIND_DIALOG_FLAG equals 0
  6. On the Add New button within the Find dialog, add the following attribute:
    1. VISIBLE_IF ADD_BUTTON_FLAG equals 1

Business Rules

In the business rules for the Area within which the above Add screen resides, add the following:

  1. Within the load directive, add:
    1. FIND_A_PROGRAM_FLAG='1';
    2. ADD_BUTTON_FLAG='0';
  2. Within the refresh directive, add:
    1. if(FIND_BTN.{changed})
      {
        FIND_DIALOG_FLAG='1';
        ADD_BUTTON_FLAG='1';
      }
      if(ADD_NEW_BTN.{changed})
      {
        FIND_DIALOG_FLAG='0';
        ADD_BUTTON_FLAG='0';
      }      
      if(RETURN_TO_FIND_BTN.{changed})
      {
        FIND_DIALOG_FLAG='1';
        ADD_BUTTON_FLAG='0';
      }
Posted on Thursday, May 26, 2011 5:05 AM | Back to top

Copyright © Mike Ellis | Powered by: GeeksWithBlogs.net