Add Two Related Record Panels to a Page

If you want to add two related record panels to a page and save them, here is how you can do it.  This is similar to a one-to-one relationship unlike a one-to-many relationship which has a Master-Detail where the Detail is a table.  In this example, the Master-Detail are both record panels.

Assume you have the following tables:

Customer:

- Id: Primary Key

- Name

- Company Name

 

Address:

- Id: Primary Key

- CustomerId: Foreign Key to Customer table (FK_Address_Customer in SQL Server)

- StreetAddress

- City

- State

- ZipCode

- Country

Normally, in this situation, Iron Speed Designer automatically creates an Add Customer Record page that contains a child **table** for the Addresses related to the Customer.

If you want to instead display a single Address record instead, here is how you can accomplish this.  This is easy to do, but not very obvious.

1. Go to the Add Customer Record page.  If you already have an Address detail table, remove it from the page.

2. From the toolbox, drag and drop another Add Record panel from the Record Panels section.  Position it where you want it by moving it up or down using the right mouse menu.

3. Press Configure and select Address table and all the fields you want to display.  On the Query step, there should be a pre-defined clause that relates the Customer and Address table.  Press Add on that clause.  Go ahead and select options on the other steps and press Finish.

(There is a bug in Iron Speed Designer in Version 2.1.2 and earlier that requires you to do the following step.  This is fixed in V2.1.3 and later.)

4. Select Tools, Page Properties.  Press Show Tree button.  Navigate to the AddressRecord node.  Select the Attributes tab.  Enter the following two attributes:

Pass-Through Attribute

Value

ParentControlName

CustomerRecord

ParentIdField

FK_Address_Customer

The ParentIdField specifies the foreign key name from Microsoft SQL Server.  Typically this is of the form FK_ChildTableName_ParentTableName.

5. Press OK.

6. Build and run your application.

For an Edit or Show Customer page, repeat the above instructions except change the references for Add Customer to Edit Customer or Show Customer as appropriate.