custom_validate() makes it easy to customize what validation components should be included during IDF object modifications using $dup(), $add(), $set() and other methods in Idf class.

custom_validate(required_object = FALSE, unique_object = FALSE,
  unique_name = FALSE, extensible = FALSE, required_field = FALSE,
  autofield = FALSE, type = FALSE, choice = FALSE, range = FALSE,
  reference = FALSE)

Arguments

required_object

Check if required objects are missing in current model. Default: FALSE.

unique_object

Check if there are multiple objects in one unique-object class. Default: FALSE.

unique_name

Check if all objects in every class have unique names. Default: FALSE.

extensible

Check if all fields in an extensible group have values. Default: FALSE.

required_field

Check if all required fields have values. Default: FALSE.

autofield

Check if all fields with value "Autosize" and "Autocalculate" are valid or not. Default: FALSE.

type

Check if all fields have values with valid types, i.e. character, numeric and integer fields should be filled with corresponding type of values. Default: FALSE.

choice

Check if all choice fields have valid choice values. Default: FALSE.

range

Check if all numeric fields have values within defined ranges. Default: FALSE.

reference

Check if all fields whose values refer to other fields are valid. Default: FALSE.

Value

A named list with 10 elements.

Details

There are 10 different validation check components in total. Three predefined validation level are included, i.e. "none", "draft" and "final". To get what validation components those levels contain, see level_checks().

Examples

custom_validate(unique_object = TRUE)
#> $required_object #> [1] FALSE #> #> $unique_object #> [1] TRUE #> #> $unique_name #> [1] FALSE #> #> $extensible #> [1] FALSE #> #> $required_field #> [1] FALSE #> #> $autofield #> [1] FALSE #> #> $type #> [1] FALSE #> #> $choice #> [1] FALSE #> #> $range #> [1] FALSE #> #> $reference #> [1] FALSE #>
# only check unique name during validation eplusr_option(validate_level = custom_validate(unique_name = TRUE))
#> $validate_level #> $validate_level$required_object #> [1] FALSE #> #> $validate_level$unique_object #> [1] FALSE #> #> $validate_level$unique_name #> [1] TRUE #> #> $validate_level$extensible #> [1] FALSE #> #> $validate_level$required_field #> [1] FALSE #> #> $validate_level$autofield #> [1] FALSE #> #> $validate_level$type #> [1] FALSE #> #> $validate_level$choice #> [1] FALSE #> #> $validate_level$range #> [1] FALSE #> #> $validate_level$reference #> [1] FALSE #> #>