# ForeignKeys

## **Specs**

<table><thead><tr><th width="320">Label</th><th>Value</th></tr></thead><tbody><tr><td><strong>Version</strong></td><td>1.2.0 (updated on 2025-03-19)</td></tr><tr><td><strong>Developer</strong></td><td>Labii Inc.</td></tr><tr><td><strong>Type</strong></td><td>Column</td></tr><tr><td><strong>Support Configuration</strong></td><td>Yes</td></tr><tr><td><strong>Support Readonly view</strong></td><td>Yes</td></tr><tr><td><strong>Support Edit view</strong></td><td>Yes</td></tr><tr><td><strong>Support Form view</strong></td><td>Yes</td></tr><tr><td><strong>Support Default value</strong></td><td>Yes</td></tr><tr><td><strong>Support Import</strong></td><td>Yes</td></tr><tr><td><strong>Allow multiple</strong></td><td>Yes</td></tr></tbody></table>

## Overview

The ForeignKeys widget within Labii operates akin to the ForeignKey widget but offers the capacity to link to one or multiple other records. This versatile widget establishes connections to multiple related data sets, allowing users to create clickable links to these associated records. This functionality enables a dynamic and comprehensive interlinking of data, facilitating efficient navigation and exploration of interconnected information within the Labii platform.

## Use case

1. Use this widget to define what other jobs related to the current job.

## Configuration

The widget will function without additional setup. However, the configuration options empower you to impose additional restrictions on the tables to which the linked data can be associated. Leave it empty to include all tables.

* **Tables** - Select one or more tables to link.

### Examples:

```json
EP,SP # List of Unique Code separated by ','.
```

## Views

See the interface of the widget in the following views.

### **Readonly view**

Readonly view display the values of the column.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-legacy-files/o/assets%2F-LHVg57XIRcjV-Vbubtn%2F-LX7Z-8rJFTs4uLc0jEp%2F-LX7ZVWybQbVkHlihcdL%2Fforeignkeys-labii-eln-lims.png?alt=media&#x26;token=cdda638c-2558-4ff0-9612-eae03bffc2c1" alt=""><figcaption></figcaption></figure>

* **Update Name**: Use this function to correct the display name of a foreign record when the name is different.
* **Open List View:** A button for List view will be accessible to open all items listed when the widget is directed to a single table.

### **Edit view**

The Edit view is the interface that allows you to modify the value.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-legacy-files/o/assets%2F-LHVg57XIRcjV-Vbubtn%2F-LX7Z-8rJFTs4uLc0jEp%2F-LX7ZRAG7Yg7d1YTyoZI%2Fforeignkeys-edit-labii-eln-lims.png?alt=media&#x26;token=1d58c684-2a74-46ef-8cfd-990f436d300f" alt=""><figcaption></figcaption></figure>

The widget allows users to add a new record if it does not already exist. To add a new record, click the “Add XXX” button. This will open a form to collect the necessary information for the record. Once the record is added, the page will redirect back to the original view.

### **Form view**

The Form view is the field integrated into the add form for collecting values when creating a new record.

The Form view is same as the Edit view.

## Data

Each widget in Labii stores data in a unique manner; refer below to understand how data from this widget is stored.

### Data format

JSON array with keys of `sid` and `name`:

```json
[{"sid":"", "name":""}]
```

### **Default value**

The Default Value field within the column allows you to specify the default value when a record is created.

Default value shall be the name or UID separated by `comma(,)`.

### **Import value**

The Import Value is the value you need to include in your Excel table for it to be imported into Labii.

Import value shall be the name or UID separated by `comma(,)`.
