Add Zoom forms

Zoom forms allow the user to pick a value from a list that is displayed in a form in a popup window.

This task assumes that you have created a BA diagram with a Program entity and at least one CRUD form entity.

  1. Right-click on the open BA diagram and select New Zoom Form.
  2. Right-click the new form and select Implement Zoom from Database from the context menu.
  3. Select the database table (in our example, the country table) that contains the values to be displayed in the zoom form. Select the column that corresponds to the field on the main form. In our example, this is the country code. (You can select the country name also, to display it in the zoom form if you wish; the code field will be identified as the unique key later in this process.)
    Figure: Example zoom form definition

    This figure is a zoom form example: a table with a country code column and a country column. All fields are Edit fields.
  4. Switch from the form design to the Records tab and select the master table record. Confirm that the active property is checked.
  5. Select the record and confirm that the unique key property is set. If not, set the unique key to one of the fields in the record.
    Figure: Records tab.

    This figure is a screenshot of Record1 and its properties. In the Properties view, the active checkbox is selected, masterTable is "country" and unique key is "country.code".
  6. Save the Zoom form (4fdz) and add it to the project structure.
    Note: It is recommended that you save the form to the $(ProjectDir)/src directory and add it to the Entities node of the project.
  7. The CRUD form has to be modified to trigger the zoom form when needed. In this example, the country.code field is changed to a ButtonEdit, which can trigger an action when the user clicks it. When the user selects the country code from the zoom form, it is automatically inserted into the country.code field on the main form. From the BA diagram, right-click on the main form and choose Open.
  8. Select the field containing the foreign key (in this example, the field.) Right-click and select Convert Widget to change the widget to a ButtonEdit.
    Figure: Convert Widget

    This figure is a screenshot of the Convert Widget menu.
  9. Scroll to the bottom of the properties list, and set the value of the action property for the ButtonEdit field to a unique action name (such as zoom).
  10. Save the form.
  11. Create a relation between the CRUD form and the Zoom in the BA diagram. On the open BA diagram, right-click the CRUD form icon, select Add Relation To, and drag the relation arrow to the second form.
  12. Select the relation arrow to display the relation properties, and complete the entries for the following properties:
    Section Property What to enter
    Source UI Settings Action Enter the action name in the action property that is the same as the one assigned to your ButtonEdit field (zoom1 in this example). If there is more than one zoom form in an application, the action name must be unique.
    Position Source Field Set the Source Field to the name of the field from the business record of the form that represents the foreign key that will ultimately be populated by the primary key selected from the zoom form.
    Filter Source Field Restrict which records appears in the zoom form by using this field to specify the criteria used to filter the records displayed in the zoom. When set, a single value is sent to the zoom form to use as a filter.
    Tip: If the properties in the Filter group are not set, the zoom displays all rows from its underlying table. It is common to not set Filter properties in a zoom relation, as the goal is to select a value from a full list, not a filtered list.
    Destination Field Specify the field in the zoom form record to use when applying a filter based on the value provided from the source record.
    Destination UI Settings Open Mode Set to DISPLAY or SEARCH.
    Default Mode Set to DISPLAY or SEARCH.
    Figure: Business Application diagram

    This figure is a screenshot of a zoom relation from a Business Application diagram.
  13. Save all diagrams and forms.