Views

A view can be thought of as a basic database query of a model that is configurable through the Studio.


  1. To create a view, we need to go back to the MPT Editor. Go to the Platform SDK perspective, and if it's not already open, double-click the Module Process Template.mpt in the Bookstore project inside the Package Explorer tile. Then select the Book Model in Outline tile (as you did earlier to add the Create Action). Then click on the Views tab, at the very bottom of the editor:
    images/download/attachments/144836593/mpt_editor_views-version-1-modificationdate-1670860986000-api-v2.png

  2. Click the Add button to create a new view. In the View Properties dialog that opens, enter the following information:

    images/download/attachments/144836593/mpt_editor_add_view-version-1-modificationdate-1670860986000-api-v2.png

    Then click OK.

  3. You should see the new view in the Views section, as well as the details for the Query tab in the View Details section. Select the following fields to be retrieved from the database for this View:
    images/download/attachments/144836593/mpt_editor_view_query-version-1-modificationdate-1670860986000-api-v2.png

  4. Also, select Title as an optional filter.
    images/download/attachments/144836593/optional_title-version-1-modificationdate-1670860986000-api-v2.png

  5. On the Display tab, you can choose which fields in the View you want to be visible to the user. We'll just leave that as default (all fields visible except ValueChainId). On the Permissions tab, make sure to select the Can access this view check box for our ZBKS.SampleRoleType.

  6. Click images/devnet.onenetwork.com/oms/apps/DeveloperNetwork/www/docs/guides/TrainingGuide/html/img/GettingStarted/save_btn.png Save to save the MPT.

  7. Click images/devnet.onenetwork.com/oms/apps/DeveloperNetwork/www/docs/guides/TrainingGuide/html/img/GettingStarted/submit_btn.png Submit to submit the MPT to the server.

  8. The next task is to add a menu item for the new BooksByTitle View for our default user, BookstoreUser, so that we can access it. To do this, navigate to the root of the MPT in the Outline tile, and select the UiMetaModel tab on the bottom left.
    images/download/attachments/144836593/module_uimm-version-1-modificationdate-1670860986000-api-v2.png

  9. Add the following XML under the other two WebActions that we saw earlier, SamplePublicResource and SampleGrid:

    <WebInfo>
    ...
    <WebAction name="BooksByTitle">
    <PanelOptions>
    <PanelClass>One.Report</PanelClass>
    <PanelConfig><![CDATA[{viewName: "ZBKS.BooksByTitle", customModelName: "Standard ZBKS.Book", autoExecute: true}]]></PanelConfig>
    </PanelOptions>
    </WebAction>
    ...
    </WebInfo>


    Then add a menu reference to this action inside the WebActionGroup tag:

    <WebActionGroup name="SampleMenuGroup">
    ...
    <WebActionRef name="BooksByTitle"/>
    </WebActionGroup>
  10. Click images/download/attachments/144836593/save_btn-version-1-modificationdate-1670860986000-api-v2.png Save to save your changes to the MPT, and then click Submit to update your local server.

  11. Log in to NEO as you did before, with the user name BookstoreUser and the password of password. You should be able to see the new menu item. Click it to see the View in the main content area:
    images/download/attachments/144836593/books_by_title-version-1-modificationdate-1670860986000-api-v2.png