Defining Views

Previous  Top  Next

Views are virtual tables, they don't store data, but do "contain" data: they are the server-side result of a SQL query. However, this data is generate on-the-fly whenever used. Views can be used in SELECT statements like any other table.

 

See also: Objects is a PDM, View

 

This topic holds the following items:

Creating a view
Modifying a view
Deleting a view
Views in sub-diagrams

 

The visual representation of a view is a rounded rectangle with a header and columns.

 

A view "Persons_With_Top_Salary"

 

In the above example, there's a view PERSONS_WITH_TOP_SALARY that selects from table PERSONS and adds a SQL WHERE clause.

 

 

Creating a view

Creating a new view is done by using the View button ( ) on the Toolbox Toolbar, this will change the cursor and allows you to click on an empty space in the Editor Workspace. A new empty View will be created, added to the list in the Diagram Explorer and added to the workspace.

 

Each View has a name, this should be a valid name in the SQL statement used to create the view and a user written description under Notes for clarity and it's meaning in the model.

 

A View needs to have a SQL query in order to be useful and it needs to have column names defined for the resultset of the SQL query.

 

Double click the View in the Diagram Explorer or Workspace to show the View Properties dialog.

 

View Properties dialog

 

The Details tab shows you the view SQL query and result columns.

 

On the DDL tab, you can view the SQL statement needed to create the view, or to modify an existing view after you've modified the column properties in the dialog.

 

See also: Views in sub-diagrams

 

Back to Top

 

 

Modifying a view

By double clicking a view in the Diagram Explorer or using the context menu and selecting Properties from the popup menu, you can start the View Properties dialog for existing views. You can also use the context menu in the Editor Workspace and select Details from the menu to open up the dialog at a different page.

 

Use the OK button to accept your changes or ESC on your keyboard or the Cancel button to discard your changes. When editing, you can switch to the DDL tab at the top of the dialog and then to Modifications at the bottom of the tab to view the DDL for your changes.

 

Back to Top

 

 

Deleting a view

You can delete a view by using the context menu and selecting Delete View from the popup menu or by pressing DEL on your keyboard when a view is selected in the Editor Workspace. If you're deleting from the Workspace in the main diagram, a special confirmation dialog will be shown. If you delete the view from the Diagram Explorer, this dialog will not be shown and the view will be permanently deleted.

 

Back to Top

 

 

Views in a sub-diagram

You can create new views in sub-diagrams too, they will be added to the Views list in the Diagram Explorer and to the diagram. To re-use existing views, drag them from the Diagram Explorer onto the Workspace.

 

Back to Top