Foreign Key Relations
A foreign key defines a relationship between two windows (tables), linking a field in one window to a field in another. This is how BrainGrid connects related data across your application.
Creating a Foreign Key
There are two ways to create a foreign key.
Method 1: Drag & Drop
- Open the canvas of the target window (the "to" table).
- From the field list of the source window (the "from" table), drag the field you want to link.
- Drop it onto the canvas of the target window.
- The foreign key relation is created between the two fields.
- Click Publish to apply the changes.
Always click Publish after creating or modifying a foreign key. Changes are not applied until saved.
Editing a Foreign Key
Once a foreign key is created, you can edit it directly from the canvas.
- On the canvas, click the field that has the foreign key relation.
- The right bar opens showing the foreign key properties.
- Update the settings as needed.
- Click Update to apply.
Viewing Foreign Keys
Foreign Key Section on the Window
All foreign keys defined for a window are listed in the Foreign Key section of the left bar. You can see:
- The source and target windows
- The linked fields
- The relationship type
Clicking on a specific field in the canvas opens the edit view where you can view and update the foreign key relation details.
Managing Foreign Keys
Delete a Foreign Key
- Open the Foreign Key section in the left bar.
- Click the ⋯ menu next to the foreign key.
- Select Delete and confirm.
Deleting a foreign key removes the relation between the two windows. All references to the linked field in the target window will be unlinked.
Restore a Deleted Foreign Key
Deleted foreign keys are sent to the Archive. To restore:
- Open the Archive section.
- Find the foreign key.
- Click Restore.
The relation is re-established in both windows.
Searching Foreign Keys
Use the search bar in the Foreign Key section to filter by field name or related window name. This is useful when a window has many relations defined.



