The set of fields that make up a data structure like a list, dataset, assay, etc can be edited using the
Field Editor interface. You will find instructions about using the field editor and using properties, options, and settings common to all field types in the topic:
Field EditorThis topic outlines the field formatting and properties specific to each data type, as well as details about advanced properties for any field.
Field Types Available by Data Structure
Fields come in different types, each intended to hold a different kind of data. Once defined, there are only limited ways you can change a field's type, based on the ability to convert existing data to the new type.
To change a field type, you may need to delete and recreate it, reimporting any data.The following table show which fields are available in which kind of table/data structure.
Notice that Datasets do not support File or Attachment fields. For a workaround technique, see
Linking Data Records with External Files.
Validators Available by Field Type
This table summarizes which formatting and validators are avialable for each type of field.
Type-Specific Properties and Options
The basic properties and validation available for different types of fields are covered in the
main field editor topic. Details for specific types of fields are covered here.
Text/Multi-Line Text/Flag Options
Fields of type Text, Multi-Line Text, and Flag have the same set of properties and formats available:
- Text Options/Multi-line Text Field Options/Flag Options: Maximum Text Length. Sets the maximum character count for the field. Options are:
- Unlimited
- No longer than X characters: provide a value in the box. The default is 4000.
- Name and Linking Options
- Conditional Formatting and Validation Options: Conditional formats and regular expression validators.
Boolean Options
- Boolean Field Options: Format for Boolean Values: Use boolean formatting to specify the text to show when a value is true and false. Text can optionally be shown for null values. For example, "Yes;No;Blank" would output "Yes" if the value is true, "No" if false, and "Blank" for a null value.
- Name and Linking Options
- Conditional Formatting and Validation Options: Conditional formats are available.
Integer/Decimal Options
Number fields, including integer and decimal/numeric fields, have these formatting options available:
Date Time Options
File and Attachment Options
File and Attachment fields are only available in specific scenarios, and have display, thumbnail, and storage differences described here.
- File - The File type is only available for certain types of table types, including assay designs and sample types. When a file has been uploaded into this field, it displays a link to the file; for image files, an inline thumbnail is shown. The uploaded file is stored in the file repository, in the assaydata folder in the case of an assay. For General Purpose assays, the File field presents special behavior for image files; for details see Linking Assays with Images and Other Files.
- Attachment - This type is similar to files, but only available for Lists. This type allows you to attach documents to individual records in a list. For instance, an image file could be associated with a given row of data in an attachment field, and would show an inline thumbnail. The attached file is not uploaded into the file repository, but is stored as a BLOB field the database. By default, the maximum file size is 50MB, but this can be changed in the Admin Console using the setting Maximum file size, in bytes, to allow in database BLOBs. See Site Settings.
Inline Thumbnails for Files and Attachments
Fields of type
File and
Attachment are available in certain structures including lists, sample types, and assay run results (see the table above for details). When the file or attachment is an image, such as a .png or .jpg file, the cell in the data grid will display a thumbnail of the image. Hovering reveals a larger version.
When you export a grid containing these inline images to Excel, the thumbnails remain associated with the cell itself.
Bulk Import into the File Field Type
You can bulk import data into the File field type, provided that the files/images are already uploaded to the File Repository. For example suppose you already have a set of images in the file Repository, as shown below.
You can load these images into a File field, if you refer to the images by their full server path in the File Repository. For example, the following shows how an assay upload might refer to these images by their full server path:
ImageName | ImageFile |
---|
10001.png | http://localhost:8080/labkey/_webdav/Tutorials/List%20Tutorial/%40files/NIMH/Images/10001.png |
10002.png | http://localhost:8080/labkey/_webdav/Tutorials/List%20Tutorial/%40files/NIMH/Images/10002.png |
10003.png | http://localhost:8080/labkey/_webdav/Tutorials/List%20Tutorial/%40files/NIMH/Images/10003.png |
10004.png | http://localhost:8080/labkey/_webdav/Tutorials/List%20Tutorial/%40files/NIMH/Images/10004.png |
On import, the Assay grid will display the image thumbnail as shown below:
User Options
Fields of this type point to registered users of the LabKey Server system, found in the table core.Users.
Subject/Participant Options
This field type is only available in a study. The Subject/Participant ID is a
concept URI, containing metadata about the field. It is used in assay and study folders to identify the subject ID field. There is no special built-in behavior associated with this type. It is treated as a string field, without the formatting options available for text fields.
Lookup Options
You can populate a field with data via lookup into another table. Open the details panel and select the folder, schema, and table where the data values will be found. Users adding data for this field will see a dropdown populated with that list of values. Typing ahead will scroll the list to the matching value. When the number of available values exceeds 10,000, the field will be shown as a text entry field.
Use the checkbox to control whether the user entered value will need to match an existing value in the lookup target.
- Lookup Definition Options:
- Select the Target Folder, Schema, and Table from which to look up the value. Once selected, the value will appear in the top row of the field description.
- Lookup Validator: Ensure Value Exists in Lookup Target. Check the box to require that any value is present in the lookup's target table or query.
- Name and Linking Options
- Conditional Formatting and Validation Options: Conditional formats and range validators are available.
A lookup operates as a foreign key (<fk>) in the XML schema generated for the data structure. An example of the XML generated:
<fk>
<fkDbSchema>lists</fkDbSchema>
<fkTable>Reagents</fkTable>
<fkColumnName>Key</fkColumnName>
</fk>
Note that lookups into lists with auto-increment keys may not export/import properly because the rowIds are likely to be different in every database.
Sample Options
- Sample Options: Select the sample reference for this field. You can choose to reference all available samples or select a specific sample type to filter by. This selection will be used to validate and link incoming data, populate lists for data entry, etc.
- Name and Linking Options
- Conditional Formatting and Validation Options: Conditional formats are available.
Related Topics