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 Attachment fields. For a workaround technique, see
Linking Data Records to Image Files.
Field Type Changes
Once defined, there are only limited ways you can change a field's data type, based on the ability to safely convert existing data to the new type. This table lists the changes supported (not all types are available in all data structures and contexts):
Current Type | May Be Changed To: |
---|
Text (String) | Text Choice, Multi-line Text, Flag, Lookup, Ontology Lookup, Subject/Participant |
Text Choice | Text, Multi-Line Text, Flag, Lookup, Ontology Lookup, Subject/Participant |
Multi-Line Text | Text, Text Choice, Flag, Subject/Participant |
Boolean | Text, Multi-Line Text |
Integer | Decimal, Lookup, Text, Multi-Line Text, Sample, User |
Decimal (Floating Point) | Text, Multi-Line Text |
DateTime | Text, Multi-Line Text, Visit Date |
Flag | Text, Text Choice, Multi-Line Text, Lookup, Ontology Lookup, Subject/Participant |
File | Text, Multi-Line Text |
Attachment | Text, Multi-Line Text |
User | Integer, Decimal, Lookup, Text, Multi-Line Text, Sample |
Subject/Participant(String) | Flag, Lookup, Text, Text Choice, Multi-Line Text, Ontology Lookup |
Lookup | Text, Multi-Line Text, Integer, Sample, User |
Sample | Text, Multi-Line Text, Integer, Decimal, Lookup, User |
Ontology Lookup | Text, Text Choice, Multi-Line Text, Flag, Lookup, Subject/Participant |
Visit Date | Text, Multi-Line Text, Date Time |
Visit ID | Text, Multi-Line Text, Decimal |
|
Unique ID | Flag, Lookup, Multi-Line Text, Ontology Lookup, Subject/Participant, Text, Text Choice |
If you cannot make your desired type change using the field editor, you may need to delete and recreate the field entirely, reimporting any data.
Validators Available by Field Type
This table summarizes which formatting and validators are available 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 ___ 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.
Text Choice Options
A
Text Choice field lets you define a set of values that will be presented to the user as a dropdown list. This is similar to a
lookup field, but does not require a separate list created outside the field editor. Click
Add Values to open a panel where you can add the choices for this field.
Learn more about defining and using
Text Choice fields in this topic:
Note that because administrators can always see all the values offered for a Text Choice field, they are not a good choice for storing PHI or other sensitive information.
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.
- File
- The File field type is only available for certain types of table, including datasets, 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 Standard Assays, the File field presents special behavior for image files; for details see Linking Assays with Images and Other Files.
- When a PDF file is stored in a File field, clicking it will download it.
- Attachment
- The Attachment field type is similar to File, but only available for lists and data classes (including Sources for samples).
- This type allows you to attach documents to individual records in a list or data class.
- For instance, an image could be associated with a given row of data in an attachment field, and would show an inline thumbnail.
- The attachment is not uploaded into the file repository, but is stored as a BLOB field in the database.
- When a PDF file is stored in an Attachment field, clicking it will open it in a new browser tab.
- By default, the maximum attachment 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.
Learn about using File and Attachment fields in Sample Manager and LabKey Biologics in this topic:
Inline Thumbnails for Files and Attachments
When a field of type
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 in LabKey Server, 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 for Study datasets and for Sample Types that will be
linked to study data. 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. This is similar to the
text choice field, but offers additional flexibility and longer lists of options.
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 Options: Conditional formats 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-incrementing keys may not export/import properly because the rowIds are likely to be different in every database.
Sample Options
- Sample Options: Select where to look up samples for this field.
- Note that this lookup will only be able to reference samples in the current container.
- You can choose All Samples to reference any sample in the container, 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 Options: Conditional formats are available.
Ontology Lookup Options (Premium Feature)
When the Ontology module is loaded, the Ontology Lookup field type connects user input with preferred vocabulary lookup into loaded ontologies.
Visit Date and Visit ID Options
Integration of Sample Types with Study data is supported using
Visit Date and
Visit ID field types provide time alignment, in conjunction with a
Subject/Participant field providing participant alignment. Learn more in this topic:
Link Sample Data to Study
Unique ID Options (Premium Feature)
A field of type "Unique ID" is
read-only and used to house barcode values generated by LabKey for Samples. Learn more in this topic:
Barcode Fields
Related Topics