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,
auto_field = FALSE,
type = FALSE,
choice = FALSE,
range = FALSE,
reference = FALSE
)Check if required objects are missing in current
model. Default: FALSE.
Check if there are multiple objects in one unique-object
class. Default: FALSE.
Check if all objects in every class have unique names.
Default: FALSE.
Check if all fields in an extensible group have values.
Default: FALSE.
Check if all required fields have values. Default:
FALSE.
Check if all fields with value "Autosize" and
"Autocalculate" are valid or not. Default: FALSE.
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.
Check if all choice fields have valid choice values. Default:
FALSE.
Check if all numeric fields have values within defined ranges.
Default: FALSE.
Check if all fields whose values refer to other fields are
valid. Default: FALSE.
A named list with 10 elements.
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().
custom_validate(unique_object = TRUE)
#> $required_object
#> [1] FALSE
#>
#> $unique_object
#> [1] TRUE
#>
#> $unique_name
#> [1] FALSE
#>
#> $extensible
#> [1] FALSE
#>
#> $required_field
#> [1] FALSE
#>
#> $auto_field
#> [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$auto_field
#> [1] FALSE
#>
#> $validate_level$type
#> [1] FALSE
#>
#> $validate_level$choice
#> [1] FALSE
#>
#> $validate_level$range
#> [1] FALSE
#>
#> $validate_level$reference
#> [1] FALSE
#>
#>