Using Associations

This tutorial task describes how to use associations in your application.

About this task

Associations are how Application Builder obtains content from a targeted entity type that is relevant to a specific entity instance. The following procedure guides you through exploring this process in the application that you have created:

Procedure

  1. In the Application Builder administration tool, click the Layouts link from the heading and select the Literary Agent entity detail page.
  2. Click the pencil icon to edit the assigned_books_list widget. This widget was automatically created when we added the association in the previous task.
  3. In the Entities to query option you can see that it has already been populated with the string subject.assigned_books. This code is comprised of the subject variable, which calls the instance of the current entity. The code then calls the assigned_booksassociation with the code, .assigned_books.

    Use this code when you want to access an association. For example, if we had an author association that associated the Book Titles entity with the Authors entity, we could call authors that are associated with the books that are assigned to this literary agent by using the code, subject.assigned_books.author. Remember that for this example, subject calls the Literary Agent entity.

  4. To see what this looks like in the application, click the Back to Literary Agent detail page button, and then drag the assigned_books_list widget to the left hand column of your application page.
  5. Click Save changes, and then click View page in app. You will be taken to the application. Notice the Assigned Books List widget on the left hand side of the page. It contains all the links to all the books that are produced by that publisher. Clicking on the title of each book will take you to the entity page for that book.

Results

You have completed this module and learned how to create associations between entities. Next, proceed to the activity feeds module, where you will learn how to collect activity information about your data and display it to the user.