In this article, we will discuss how to design a many to many form/record relationship based on the sample app.

There are 3 tables needed in total in order to form a many-to-many relationship:-

  • Many2Many_table1
  • Many2Many_table2
  • Many2Many_joiner

where the last table mentioned will act as the junction table.

In this generic sample app, we are treating "Form 1" as ingredients and "Form 2" as a recipe.

The figure below shows the list of recipes.

The figure below shows the list of ingredients.

A recipe requires multiple ingredients and an ingredient is used by multiple recipes. The following figure depicts the "joiner" records.

And, here's how the joiner table records look like. Observe c_id_form1 and c_id_form2. They are the foreign key to table1 and table2 respectively.

This is table1 data.

This is table2 data.

The app is created using simple select box and form grid. You may study its design by downloading the sample app below.

The figure below shows the design of Form1.

Based on the figure below, we can see that Form 1 has:-

  1. An ID Generator Field to create a running number as record ID.
  2. Text Field
  3. Form Grid to select items from Form 2 to be stored in the joiner table.

Form 2 has identical form design as per Form 1, as explained below.

In the joiner form, it contains just 2 select boxes.

Each of the select boxes would point to Form 1 and Form 2 using Default Form Options binder as shown in the form structure figure below.

You may try it out yourself by downloading the sample app below.

Sample App

APP_Many2Many-1-20180507154857.jwa

 

 

 

  • No labels