Tutorial 202:

Extend

Tutorial 202: Lesson 4

Expanding your data model

Lesson Materials
Download Files

Many-to-many relationships

You’ve quickly addressed some feature requests for your app through layout changes and scripting, but other features may require more planning. To add a new class of user to your app, you may need to adjust your data model to accommodate different types of information.

Some new features may require only minor tweaks to your data model, such as a new field. More complex features might require new tables or relationships, or a new type of relationship: a many-to-many relationship. In this lesson, to fulfill the bookkeeper's report request, you’ll think through the data model changes, then add a table to store more details about the types of services you offer, and use that table in a many-to-many relationship.

As you adjust the underlying structure of your app, you’ll likely also need to adjust the interface. For example, users may need to fill in foreign key fields — how do you make that easy? You’ll learn a useful layout feature for this. 

Why is this important?

  • As your app evolves, the data model supporting it will need to change. Adding fields or tables as needed will keep your data clean and reportable.
  • Data is only clean and reportable if it’s in the app — and it’s only in the app if it’s easy for users to enter. Any new data requirements should be accompanied by thoughtful interface changes.

Video 1

Planning your data model changes

Follow the activity below to think through the data structure needed for your new features, and learn about many-to-many relationships.

In this video, you will:

  • Review your goals: choose a complex problem statement (0:25)
  • Identify new tables: find new entities for your entity-relationship diagram (1:03)
  • Find new relationships: make new connections (2:06)
  • List new fields: decide what new data you need (7:04)
  • Extend the concept: learn about many-to-many relationships in the real world (7:17)

Video 2

Making your data model changes

Create a table and populate it with data at the same time, by creating via import. Then add a relationship for the new Billing Codes table in the sample app.

In this video, you will:

  • Add a new table & fields via import: bring in data and a place to store it all in one action (0:57)
  • Create a relationship: connect Billing Code to Service (2:51)
  • Test the link: populate the foreign key to see the relationship work (5:26)
  • Auto-populate related information: pull Billing Code data into the Service table (6:52)

Video 3

Helping users enter foreign key data

Update the Visit Details layout so users complete the Billing Code ID field without extra effort.

In this video, you will:

  • Create a dynamic value list: use Billing Code data in a value list (1:46)
  • Show user-friendly choices: display information the user understands while capturing the ID the system needs (4:01)
  • Test the change: view the pop-up list as a user (5:04)
  • Mass-update new fields: add missing data to the fields created earlier in the lesson (6:14)

Related Resource