Lantica Software Support Center
Lantica Software Home Page


Knowledgebase

Creating Subforms in Your Application


Subforms are a way to view Records from a second database while in the Form of a master database - so that you can see Records from both databases at the same time. Therefore, you will need at least two databases in an application before you can create subforms, each based on a different database in the same application. (If you are unclear about the differences between a Sesame "database" and an "application", see The Anatomy of a Sesame Application: Terminology, elsewhere in this Knowledgebase, or consult your Sesame User Guide.)

You don't need to create relationships between databases before using your Subform. Sesame creates these relationships for you when you add a Subform to a Main Form.

Because Subforms are dynamic, you can edit data, delete records and add records in a Subform.

Step one is to create a new database for the subform. (If you are not familiar with creating new databases/forms, or just need to brush up, see "Designing a Sesame Application" in the Sesame User Guide.)

To add a new Form, select Forms -> Add New Database. Enter the name for this new database and form (though the name of your form and the name of your database can be the same, it is not necessary). This opens up a new, blank Form. Use the Layout Element Adder to add the desired Layout Elements (or LE's). When you are finished, save your work. You now have both a new database and a new form. Close the design tab.

At this point, your menu tree should show the new database that you have just created and its new form at the same level as the original, existing database. It should be directly beneath the orignial and not indented. This shows that the two databases are independent.

Step two is to add the form you have just created to the original, existing form in your application as a Subform.

Open the main form or Parent Record (the original, existing form) in Designer. Click on the form where you want to place your subform. In the Layout Element Adder, select element type: Subform. The Bind Element To must remain Unbound. If you wish to label your subform, do so now with the text of your choice - this will appear above the subform by default, though you can move it if you wish. Click on the Add Element to Form button.

Sesame should now be displaying the Subform Settings dialog window. This consists of 5 sections, which control the way the subform and underlying linking mechanisms are established:

  1. Select a Form - This dropdown menu lists all the eligible forms in your database. Select the form you wish to use as the subform.
  2. Select Subrecord Type - This menu lists the available link types. Here, you will tell Sesame how to decide which records in the database are conidered children of the parent record. The two choices are Automatic (Natural Links) or Matching Field Values (Relational Links). For more on this, see the Sesame User Guide or the Knowledgebase article listed below.)
  3. Select Records to Display - For both Natural and Relational Links you will see three sets of choices.
    1. Make Natural Child Record: This is the most common choice. Records in the subform are automatically linked to corresponding records in the main/parent form. The correct child records will appear in the subform based on your settings. (If Relational Links is selected, this option changes to Show Related Child Records, but the same logic applies.) Child records can also be accessed by opening the subform by itself. In this case all the records are shown mixed together.
    2. Show Existing Natural Child Records: If the main/parent database already has a subrecord database(s) with appropriate linking, they'll be listed in a dropdown menu here. If one of these is selected, Sesame will use a pre-existing relationship, as would occur if another subform had already been created (in other words, the same records from the database will be shown as in the subform that initially created the existing field definition).
    3. Create a New Database with Shared Template: If this choice is selected it clones the selected form and database, but without any data. This is useful when you need to add a form as a subform, which does not already exist. The records added using this subform won't mix with records added using other subforms, even though the subforms look identical. "Shared Template" means that all databases/forms that share a template will be kept in synch. So, if you add an LE to one form, all forms will have that element.
  4. Set Subform Properties - You must assign a Field Name to the subform, and, if applicable, pick the matching fields for a Relational Link.
  5. Select a View - Here, you will select whether you want to display the records in the subform in Table or Form view. (Form view shows LE's arranged on the form just as it was designed, while Table View shows records in a spreadsheet-like view with rows and columns - this is the most common choice for a subform as you can view multiple records at one time in this view).

Click OK and your subform is now added to the form. You can now resize or reposition the subform on the main form to your liking. Make sure to Save the layout once you've got everything looking the way you want it to look! Reconcile or save your design. (See the Knowledgebase articles: Reconciling an Application and Reconcile Application Options for more info on the Reconcile process.)

Looking back at the menu tree, you will see that the newest database is now indented under the original,existing database, rather than being directly underneath it.


See also:

In the Sesame User Guide:

  • Section 3-Designing a Sesame Application, Section 5-Creating Subforms, Section 7-Navigating Forms, 13-Working with Subforms.

From the Sesame Quick-Start Tutorial:

Other Knowledgebase Articles: