Relationships in SharePoint list and Power Apps
In this exercise, we will learn how to create relationships between sharepoint lists.
To employ the relationships in the sharepoint list, we can create lookup columns. Here are the following steps on how to create a lookup column in a SharePoint list:
Step 1: Go to the list where we want to create the lookup column.
Step 2: Click on the List Settings gear icon.
Step 3: In the List Settings page, click on the Columns tab.
Step 4: Click on the Add Column button.
Step 5: In the Add Column dialog box, select the Lookup option.
Step 6: In the Column Name field, enter a name for the lookup column.
Step 7: In the Get Information From field, select the SharePoint list that contains the data we want to use for the lookup.
Step 8: In the Column field, select the column in the SharePoint list that we want to use for the lookup.
Step 9: (Optional) If we want to display additional columns from the source list in the lookup column, select the More Options checkbox and select the additional columns.
Step 10: Relationship Behaviour between the Lists A lookup column establishes a relationship between list items in this list and related items in the target list (Source list for the lookup column). Specify the relationship behavior enforced by this lookup column when a list item in the target list is deleted.
a) Cascade delete: When an item in the target list is deleted, cascade delete will delete all related items in this list.
b) Restrict delete: Restrict delete will prevent the deletion of an item in the target list if it has one or more related items in this list.
Note: By default, the functionality is, deleting the source items in the list does not have an impact on the related items in the sharepoint list. But we can employ the relationship behaviour between the source and the related list.
Step 10: Click on the OK button.
Our SharePoint lookup column will now be created.
Here are some additional things to keep in mind when creating a lookup column:
- The lookup column must be associated with a SharePoint list.
- The lookup column can only be associated with a list that is located in the same site collection as the list where the lookup column is being created.