Step 6: Select Virtual Primary Keys and Virtual Foreign Keys

Optionally add virtual primary keys and virtual foreign keys that enable Iron Speed Designer to create additional, more robust web pages for your application.

Iron Speed Designer creates a wide range of web pages for each database table and view you select.  The quality and comprehensiveness of your application depends, in part, on your database design.  The more complete your design, the better Iron Speed Designer can do.

The primary and foreign keys definitions in your database are key (pardon the pun) to creating a full suite of web pages.  However, in many cases, you may not be able to explicitly define primary and foreign keys in your database.  Iron Speed Designer provides an alternative that lets you instruct Iron Speed Designer to treat designated fields as ‘virtual primary keys’ and ‘virtual foreign keys’.

Virtual primary keys

As with explicitly declared primary keys, Iron Speed Designer creates Edit and Show Record and Workflow pages using virtual primary keys.  This is especially useful for database views which may not be permitted to have explicit primary keys.  Unfortunately not all databases permit you to explicitly declare primary keys in database views, so declaring a virtual primary key in Iron Speed Designer may be the only way to create certain page types.  Even if the database does permit primary keys for views, the particular views you are using may not have them defined.

Iron Speed Designer suggests potential candidate virtual primary key fields using these criteria:

Virtual foreign keys

As with explicitly declared foreign keys, Iron Speed Designer uses virtual foreign key relationships to create master-detail pages.  This is especially useful for database views which may not be permitted to have explicit foreign keys.  Unfortunately not all databases permit you to explicitly declare foreign keys in database views, so declaring a virtual foreign key in Iron Speed Designer may be the only way to create certain page types.  Even if the database does permit foreign keys for views, the particular views you are using may not have them defined.

Iron Speed Designer suggests potential candidate virtual foreign key fields when the database field’s name ends with a common foreign key suffix, such as “ID”, “NUM”, and “NUMBER” (case insensitive), and there is another table whose primary key field or virtual primary key field has same name.  For example:

Categories.SupplierID à Suppliers.SupplierID

Creating Edit Record and Show Record pages for database views

You can easily display and edit records for database views.  In some cases, you may have already created Table Report and Edit Table pages and the icon links to the associated Edit Record and Show Record pages are missing.

To enable editing of database views and, by implication, their underlying table records, two conditions must be met:

Virtual Primary Keys can be added via the Application Wizard’s Keys step and via the Databases menu.

Missing Edit Record and Show Record pages

In some cases, the icon links to Edit Record and Show Record pages will be missing from Table Report and Edit Table pages you create.

The primary reason for this is the underlying database table or view does not have a primary key, which makes it impossible for Iron Speed Designer’s Application Wizard to create pages for editing and displaying specific records.  You can easily remedy this by adding a primary key for the table or view in your database.  If this is not possible, then you can add a Virtual Primary Key (VPK) directly in Iron Speed Designer, a facility that instructs Iron Speed Designer to treat the designated field as if it were a primary key.  After adding either the primary key in the database table or a Virtual Primary Key in Iron Speed Designer, use the Application Wizard to re-create the associated pages.

Non-updatable database views

Iron Speed Designer excludes certain database views as Virtual Primary Key candidates in situations that indicate the database view is not updateable, such as when the view:

Some database views may not be recognized by Iron Speed Designer as not being updateable. In these cases, the Keys step may suggest Virtual Primary Keys.  Selecting these VPK’s may result in a compile-time or run-time error because the view is not updateable.

See Also

What is an Iron Speed Designer Application?

Creating Your First Application

Step 1: Prepare your Database

Step 2: Select the application type

Step 3: Select a Web Page Style

Step 4: Connect to a Database Server

Step 5: Select Pages to Create

Step 6: Select Virtual Primary Keys and Virtual Foreign Keys

Step 7: Select Language and Localization Settings

Step 8: Name Your Application

Step 9: Build Your Application