BrainGrid Controller
Window
Foreign Key Relations

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

  1. Open the canvas of the target window (the "to" table).
  2. From the field list of the source window (the "from" table), drag the field you want to link.
  3. Drop it onto the canvas of the target window.
  4. The foreign key relation is created between the two fields.
  5. Click Publish to apply the changes.
Drag and drop to create a foreign key
⚠️

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.

  1. On the canvas, click the field that has the foreign key relation.
  2. The right bar opens showing the foreign key properties.
  3. Update the settings as needed.
  4. Click Update to apply.
Edit foreign key via the right bar

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
Foreign key section on the window left bar

Clicking on a specific field in the canvas opens the edit view where you can view and update the foreign key relation details.

Edit foreign key relation

Managing Foreign Keys

Delete a Foreign Key

  1. Open the Foreign Key section in the left bar.
  2. Click the menu next to the foreign key.
  3. 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:

  1. Open the Archive section.
  2. Find the foreign key.
  3. 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.