Show TOC

Procedure documentationDisplaying Information in a Popup Window Locate this document in the navigation structure

 

This section describes how to display information about each product in the sales order inside a popup window.

It covers how to:

  • Search for a data service that returns product details

  • Display the returned data in a form in a popup window

  • Display data from different nodes in a complex dataset using dynamic expressions

Procedure

  1. Discover and define the data service that provides product details:

    1. Open the SalesOrderDetails model if it is not already open.

    2. Click the Search button in the task-panel toolbar. The Search task panel is displayed.

    3. From the Search in dropdown list, choose Services Registry and click the Search… button. The Services Registry Wizard is displayed.

    4. In the Find field, enter QueryProduct and click Next. The WSDL PortType Name that we need – ProductByIDAndDescriptionQueryResponse_In – is displayed.

    5. Click Next to display the defined endpoints for the service. The service we selected has a single endpoint with a single operation.

    6. Click Finish to add the operation to the Search task panel.

    7. Drag the operation onto the Design board. The Define Ports dialog box is displayed.

    8. Select the checkbox next to the ProductByIDAndDescriptionQuery node under In Ports. In the Fields pane, make sure that only ProductID and MaximumNumberValue are selected.

    9. Under Out Ports, expand the nodes and select only the following fields:

      Node

      Fields to Select

      ProductByIDAndDescriptionResponse

      No fields selected

      Product

      ProductID

      CategoryID ProductPrice

      currencyCode

      Description

      Description

      Name

      Name

    10. Click OK.

  2. Define the data flow, connecting lines, and mappings:

    1. Drag from the out port of the Item Details table to the in port of the data service you just added. A data map connecting line joins the two elements.

    2. Double-click the new data map line to define the data mapping. The Map Data dialog box is displayed.

    3. To map the ID field from the output of the Item Details table to the ProductID field in the input of the data service, select the mapping line between the two root nodes. In the ProductID row of the Assigned Value column in the lower part of the dialog box, choose ID from the dropdown list.

    4. In the MaximumNumberValue row of the Assigned Value column in the bottom pane of the dialog box, enter the default value 10.

    5. Click Close.

  3. Define the output:

    1. To define the output UI element, a form showing details for the product selected in the Item Details table, drag out from the ProductByIDAndDescriptionResponse port of the data service and choose Form View from the context menu. The Define Data dialog box is displayed.

    2. Select the Product node on the left and click Deselect All. Add controls for the following fields: ProductID, CategoryID, ProductPrice, and currencyCode (make sure that you add controls for only these fields, and not the complex fields). Click Close. A new output form is added to Storyboard. Your model should look similar to this:

      Model with Product Form (Model with Product Form)

    3. Save your model.

  4. Define the layout of the UI:

    1. Switch to the Layout board.

    2. In the Product form, reorder, rename, and resize the UI controls and layout so it looks similar to this:

      Layout of Product Details
Form (Layout of Product Details Form)

      Note Note

      The Price field is actually a Melting Group control that has been renamed, and contains the ProductPrice and currencyCode fields.

      End of the note.
    3. We also want to display the product description in the Product Details form. However, the field that contains this data is nested in a clustered dataset, so we cannot add it the way that we added the other fields. We can add a control to display the data and then define a dynamic expression for the field value of the control:

      1. From the Compose task panel, drag a Text Editor control to below the last control on the Products Details form. Rename it to Description and adjust its height so that it can display approximately two lines of text.

      2. In the Configure Text Editor task panel, select Define expression from the dropdown list in the Value field.

      3. In the Dynamic Expression Editor dialog box, delete any text that may be in the Expression pane and navigate to the following node in the tree on the right:   Data Fields   ProductByIDAndDescriptionQueryResponse_In.ProductBy   IDAndDescriptionResponse   Product   Description  . Then double-click the Description field that is located under the Description node and click OK. This specifies that the Description control displays the value taken from the Description field.

  5. Save the model.

  6. Add a popup container:

    1. From the Compose task panel, drag a Popup container to the right-side of the Design board and rename it Product Details.

    2. In the Configure Popup task panel, clear the Cancel button checkbox and click Yes in the confirmation dialog box (so that the popup window will have only an OK button).

    3. Drag the Product Details form into the popup container and in the Configure Form View task panel, clear the Show title checkbox (we do not need to show the form title since the popup window also has a title).

    4. Right-click the popup container and choose Layout Board from the context menu to display the layout of the popup container and its contents. Resize the form and the popup window to fit the controls in the form and then click Close (Close) in the Layout board title bar to close the window.

      Now we want to add a button to the Item Details table that opens the popup showing details for the product that is selected in the Item Details table.

    5. Select the Item Details table and switch to the Layout board.

    6. Drag a Button control from the Compose task panel to the toolbar of the table and rename the button Product Details.

    7. Right-click the button and choose Action from the context menu.

    8. In the Define Action dialog box, click Add Action (Add Action) and choose   More   Open Window  . In the Window field on the right, select Product Details (the name of the popup container) and click Close.

  7. Save, deploy, and view the application:

    1. Deploy the model and run the application.

    2. In the runtime application, select Saskia Sommer in the Buyer ID field and click Submit. The Item Details table now has a Product Details button in its toolbar and should look similar to this:

      Runtime Application (Runtime Application)

    3. Select a row in the table and click the Product Details button to display information about the selected product in a popup window:

      Product
Details Popup Window (Product Details Popup Window)

Result

You have now displayed product information in a popup window. In the next section, Adding a Product Image, you will add an image of each product to the popup window.