Creates the specified table column on a NocoDB server via its
POST /api/v2/meta/tables/{id_tbl}/columns API endpoint.
Usage
create_tbl_col(
id_tbl,
column_name,
title = column_name,
uidt = NULL,
colOptions = NULL,
dt = NULL,
cdf = NULL,
rqd = NULL,
pk = NULL,
ai = NULL,
au = NULL,
un = NULL,
enable_rich_text = NULL,
origin = funky::config_val("origin"),
email = funky::config_val("email"),
password = funky::config_val("password"),
api_token = funky::config_val("api_token")
)Arguments
- id_tbl
character(1)
NocoDB table identifier as returned bytbl_id().- column_name
character(1)
Column name.- title
character(1)
NocoDB column title.- uidt
character(1)
NocoDB user interface data type. EitherNULLfor the column's currentuidtvalue or one of"AI""Attachment""AutoNumber""Barcode""Button""Checkbox""Collaborator""Count""CreatedBy""CreatedTime""Currency""Date""DateTime""Decimal""Duration""Email""ForeignKey""Formula""GeoData""Geometry""ID""JSON""LastModifiedBy""LastModifiedTime""Links""LinkToAnotherRecord""LongText""Lookup""MultiSelect""Number""Order""Percent""PhoneNumber""QrCode""Rating""Rollup""SingleLineText""SingleSelect""SpecificDBType""Time""URL""User""Year".
- colOptions
list()
NocoDB column options. To specify the values for a single-select field (uidt = "SingleSelect"), supply a data frame with the columnstitle,color(HEX color code) andindex(counted from 0 upwards) as a list element namedoptions. Defaults to the column's currentcolOptionsvalue ifNULL.- dt
character(1)
Column data type. Omitted ifNULL.- cdf
character(1)
Column default value. Defaults to the column's currentcdfvalue ifNULL. Setcdf = NAto remove an existingcdfvalue.- rqd
logical(1)
Whether or not the column is required to be filled, i.e. should have aNOT NULLconstraint. Corresponds to theNNadvanced field attribute. Defaults to the column's currentrqdvalue ifNULL.- pk
logical(1)
Whether or not the column is a primary key, should have aPRIMARY KEYconstraint. Corresponds to thePKadvanced field attribute. Defaults to the column's currentpkvalue ifNULL.- ai
logical(1)
Whether or not to auto-increment the column value on new record insertion. Corresponds to theAIadvanced field attribute. Defaults to the column's currentaivalue ifNULL.- au
logical(1)
Whether or not to auto-update the column value to the current timestamp on record creation/insertion. Corresponds to theAUadvanced field attribute. Defaults to the column's currentauvalue ifNULL.- un
logical(1)
Whether or not the column is an unsigned number, i.e. can only store non-negative numbers. Corresponds to theUNadvanced field attribute. Defaults to the column's currentunvalue ifNULL.- enable_rich_text
logical(1)
Whether or not to enable rich text support for the column in NocoDB. Only applicable ifuidt = "LongText". Omitted ifNULL.- origin
character(1)
NocoDB server origin.character(1)
E-mail address of the NocoDB user to authenticate with.- password
character(1)
Password of the NocoDB user to authenticate with.- api_token
character(1)
NocoDB API token. Takes precedence overemailandpasswordif provided.
Value
A tibble with metadata about the newly created NocoDB table column, invisibly.
See also
Other functions to manage NocoDB table columns:
delete_tbl_col(),
set_display_val(),
set_display_vals(),
tbl_col(),
tbl_col_id(),
tbl_cols(),
update_tbl_col()