createFormSchemaFromData: Creates a form schema from a data set by guessing the field...

View source: R/forms.R

createFormSchemaFromDataR Documentation

Creates a form schema from a data set by guessing the field types required

Description

This function helps to create new form schemas for existing datasets.

Usage

createFormSchemaFromData(
  x,
  databaseId,
  label,
  parentId,
  keyColumns = character(),
  requiredColumns = keyColumns,
  logicalAsSingleSelect = TRUE,
  logicalText = c("True", "False"),
  codes = rep(NA_character_, ncol(x)),
  upload = FALSE,
  folderId,
  parentFormId = NULL,
  parentRecordIdColumn = NULL
)

Arguments

x

the data.frame or tibble for which to create form fields and a form schema

databaseId

the id of the database to which the form should belong.

label

the label of the new form

parentId

The id of the database or folder to which this should be added. Defaults to the database. This argument only has an effect if upload is TRUE.

keyColumns

a character vector of the column names of the form fields that should be form keys

requiredColumns

a character vector of the column names of the form fields that should be required

logicalAsSingleSelect

by default TRUE and converts logical columns in the data frame to a single select form field; if FALSE then it will convert TRUE to 1 and FALSE to 0

logicalText

the single select replacement values for c(TRUE, FALSE); default is c("True","False")

codes

a character vector of field codes that must have the same length as the number of columns

upload

immediately upload the new form

folderId

Deprecated; use parentId. Optional id of a folder where the form should reside. This argument only has an effect if upload is TRUE.

parentFormId

The parent form id when creating a sub-form.

parentRecordIdColumn

The column with the parent record id. This is ignored during schema creation but used to link sub-form records to parent records.


bedatadriven/activityinfo-R documentation built on Dec. 21, 2024, 8:23 a.m.