9.3. Creating Multiple Views

Creating multiple views is actually quite easy and can greatly enhance the usability of the InfoPath forms. To accomplish creating a new view, press the Add a New View... button. This will create a blank view that you can fill in. Since you will be using the same data source you don't have to worry about that step. Once the view is created you can then modify the view properties for display in the menu and customize as needed.

9.3.1.

9.3.1.1. Try It Out: Adding the Notes and Orders Views

It's time now to create a couple of more views for your form. You will be using the Notes field for one view and the tblOrders table for the other. Using the same form you have been working on in this chapter:

  1. Click the Views task in the Design Tasks task pane.

  2. Click the Add a New View... link. The Add View dialog box will be displayed.

  3. Type Notes in the New view name text box, as shown in Figure 9-12.

    Figure 9.12. Figure 9-12
  4. Click OK. A blank view will be created and displayed.

  5. Click the Data Source task in the Design Tasks task pane.

  6. Drag and drop the Notes field from the tblCustomers table in the dataFields branch of the data source. A repeating section will be created with Notes field included.

  7. Arrange the Notes label and field on the view as shown in Figure 9-13.

    Figure 9.13. Figure 9-13
  8. Click the Views task in the Data Source task pane.

  9. Click the Add a New View link once again. The Add View dialog box appears.

  10. Type Orders for the new view name, and click OK. A new blank view will be displayed.

  11. Click the Data Source task.

  12. Drag and drop the tblOrders table onto the view. Then a menu with types of sections will appear on the right.

  13. Choose Repeating Section with Controls. The new view is then created as shown in Figure 9-14.

    Figure 9.14. Figure 9-14
9.3.1.2. Try It Out: Switching between Multiple Views

The new views have now been created. It's time now to test the new views.

  1. Click Preview Form. The InfoPath form opens.

  2. Type in BOLID for the Customer ID field under the Run Query button.

  3. Click Run Query. The customer information is displayed.

  4. Click the View menu, you will see the three views displayed, as shown in Figure 9-15.

    Figure 9.15. Figure 9-15
  5. Select ViewNotes. The Notes view becomes visible, as shown in Figure 9-16. You may modify the text of the note and click the Submit button.

    Figure 9.16. Figure 9-16
  6. Select ViewOrders. The Orders view is now displayed, as shown in Figure 9-17.

It is great to be able to switch between views without any work using the built-in menus. However, it is nice to give users a custom task pane that displays the views that are available. The next chapter covers just this.

Figure 9.17. Figure 9-17

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.85.100