How To: Add Lookup Information to a Form

In the following scenario, you are using a Region SmartObject Lookup on a view containing other information about a customer view. Although only the Region ID is stored in the Customer SmartObject, the names of the regions are displayed in a popup dialog for you to choose from. These names are stored in the Region SmartObject.

Steps

Follow the steps below to set up the Customer view with Region SmartObject Lookup.

  1. Create two SmartObjects called Customer and Region with following properties:

    Customer SmartObject PropertyTypeKeyRequiredUnique
    CustIDAutonumberYesNoYes
    CustNameTextNoNoNo
    CustNumberNumberNoNoNo
    RegionIDTextNoNoNo


    Region SmartObject PropertyTypeKeyRequiredUnique
    RegionIDAutonumberYesNoYes
    RegionNameTextNoNoNo
    RegionAliasTextNoNoNo
  2. Generate an Item View for the Customer SmartObject and a List View for the Region SmartObject.

  3. Edit the Customer Item View, select the Region ID field, and then click the Change Control icon.
  4. Change the control to Lookup and then click OK.
  5. You must specify the Region ID field as the data source for the Lookup SmartObject. Select the Region ID field and click the ellipsis in the SmartObject option of the Data Source section.
  6. Select the Region SmartObject and click OK. The Method, Value and Display is populated as shown below. Click OK.
  7. Navigate to the Rules tab of the step and click Add Rule. Select When a control on the View raises an event. Select the RegionID Lookup control and select Clicked. Click the Actions tab at the top.
  8. Select Open a subview located in the Subview Interaction section. Select the Region List view. This rule opens the Region List view in a subview when the RegionID lookup control is clicked. Click OK.
  9. Note that the Region List subview executed Initialize rule is added automatically when adding the rule. This rule populates the Region List subview.
  10. Click Add Rule again. Under Events, in the Subview Events section, select When a subview executes a method. Select the Region List subview and List item double click as the method. Click the Actions tab.
  11. Select Transfer data
  12. Click on Configure and map the RegionID as shown below. Click OK.
  13. Select Close a subview or subform under the Subview Interaction section. Click OK and Finish to save the view. This rule transfers data from the Region List subview to the Customer View when an item is double clicked on the subview. The Region List subform then closes.
  14. Enter some region information in the Region SmartObject. Do this by creating an Item View and using that to fill in some regions.
  15. Run the Customer Item view. Click the ellipsis in the Region ID control.
  16. The Region List subview opens with the data you entered in step 14. Double-click a region. Note how the subview closes.
  17. The item you double-clicked on the Region List subview is added to the Customer Item view.