Appendix A. System function reference: validation functions
|
Function |
Signature |
Description |
Parameters |
Returns |
|---|---|---|---|---|
|
isValidDate |
isValidDate(value, exp) |
Determines whether a date value is in a valid date format. |
value — string, required: date value to validate exp — RegExp, optional: custom regular expression for date format |
boolean:
|
|
isUNKDate |
isUNKDate(value) |
Determines whether a date value containing "UNK" (Unknown) is in a valid date format. |
value — string, required: date value to validate |
boolean:
|
|
isValidTime |
isValidTime(value, exp) |
Determines whether a time value is in a valid 24-hour time format. |
value — string, required: time value to validate exp — RegExp, optional: custom regular expression for time format |
boolean:
|
|
isUNKTime |
isUNKTime(value) |
Determines whether a time value containing "UNK" (Unknown) is in a valid time format. |
value — string, required: time value to validate |
boolean:
|
|
isTime |
isTime(value) |
Determines whether a time value is in a standard 24-hour format. |
value — string, required: time value to validate |
boolean:
|
|
isTime12 |
isTime12(value) |
Determines whether a time value is in a standard 12-hour format. |
value — string, required: time value to validate |
boolean:
|
|
Function |
Signature |
Description |
Parameters |
Returns |
|---|---|---|---|---|
|
isLater |
isLater(dateValue, historyDateValue) |
Determines whether the first date value is after (or equal to) the second date value. |
dateValue — string, required: first date value to compare (expected to be the later date) historyDateValue — string, required: second date value to compare (expected to be the earlier date) |
boolean:
|
|
isDateAfter |
isDateAfter(date1, date2) |
Determines whether the first date is after the second date (supports dates containing UNK). |
date1 — string, required: first date value to compare (expected to be the later date) date2 — string, required: second date value to compare (expected to be the earlier date) |
boolean:
|
|
hasValidEqualDate |
hasValidEqualDate() |
Determines whether a base date has an equal match among a set of comparison dates (special rule). |
arguments — string[], variable:
|
boolean:
|
|
isTimeRange |
isTimeRange(date2, time2, date1, time1, timepoint, condition) |
Determines whether two date and time pairs satisfy a time point range condition. |
date2— string, required: second date value (minuend date) time2 — string, required: second time value (minuend time) date1 — string, required: first date value (subtrahend date) time1 — string, required: first time value (subtrahend time) timepoint — string, required: timepoint label used to match the corresponding range configuration in condition condition — string, required: stringified 2D array defining the allowed ranges for each timepoint |
boolean:
|
|
dateComparison |
dateComparison(curDate, exp, unit, compareDate) |
Determines whether the current and previous item group entries in a log form satisfy a specified date condition (applies to log forms only). |
curDate — string, required: date value of current record exp — string, required: comparison expression string, e.g. ">5", "<10", ">=3", "<=7" unit — string, required: unit for date difference calculation:
compareDate — string, autofilled by system: date value of previous record |
boolean:
|
|
Function |
Signature |
Description |
Parameters |
Returns |
|---|---|---|---|---|
|
mustAnswer |
mustAnswer(value) |
Determines whether an item's value has been filled in (non-empty validation). |
value — any, required: item value to validate |
boolean:
|
|
isRange |
isRange(value, minValue, maxValue) |
Determines whether an input value is within a specified closed interval (inclusive of boundary values). |
value — string/number, required: value to validate minValue — number, required: minimum value of range (inclusive) maxValue — number, required: maximum value of range (inclusive) |
boolean:
|
|
mustCheck |
isChecked(value) |
Determines whether a radio button or dropdown item is selected (non-empty is considered selected). |
value — string, required: radio button/dropdown item value to validate |
boolean:
|
|
isValidFloat |
isValidFloat(value, decimal) |
Determines whether a floating-point number meets the specified precision (decimal places validation). |
value — string, required: float value to validate (in string form) decimal — number, optional: required number of decimal places (exact match) |
boolean:
|
|
isRepeatValue |
isRepeatValue() |
Determines whether a specified item's value is duplicated in other item groups (primarily used in log forms). |
value — any[], variables:
|
boolean:
|
|
isNotNullAndEmpty |
isNotNullAndEmpty(value) |
Determines whether a value is non-empty (not null, not empty string, or not undefined). |
value — any, required: value to validate |
boolean:
|
|
Function |
Signature |
Description |
Parameters |
Returns |
|---|---|---|---|---|
|
condition |
condition(condition, validate, elseValue) |
Determines whether a condition is met and returns a specified value based on the result (a conditional branching function). |
condition — boolean, required: condition expression to evaluate (result is true/false) validate — any, required: return value when condition is true (typically result of another validation function) elseValue — any, optional, default = true: value returned when condition is false (default prevents query generation) |
any:
|
|
isItemEnable |
isItemEnable(itemId) |
Determines whether the specified item is in an enabled state. |
itemId — any, required: item identifier (item's enabled state value is automatically passed in by system) |
boolean:
|
|
isPrevCycleItemEnable |
isPrevCycleItemEnable(itemId) |
Determines whether the specified item in the previous cycle is in an enabled state. |
itemId — any, required: item identifier (automatically replaced by system with enabled state value from previous Cycle) |
boolean
|
|
NotEmptyIgnoreRule |
NotEmptyIgnoreRule(condition) |
Ignores rule validation when a non-empty value is already stored in the database; otherwise returns based on a condition (a conditional ignore function). |
condition — boolean, required: condition expression to use when database value is empty val — string, autofilled by system: stored value of current rule's item in database |
boolean:
|
|
validateRelatedFormDates |
validateRelatedFormDates(relatedFormDateItem, comparisonOperator, thisFormDateItem) |
Validates whether dates in a related form satisfy the specified comparison condition. |
relatedFormDateItem — string, required: date item identifier in Related Form (e.g. '$AE.AESTDAT') comparisonOperator — string, required: comparison operator, supports '==', '!=', '>', '<', '>=', '<=' thisFormDateItem — string, optional: date item in current form to compare against; if omitted, uses rule's own item relatedDates — string[], variable, auto-filled by system: expanded list of date values from Related Form |
boolean:
|
|
isRelatedByForm |
isRelatedByForm(relatedFormItem) |
Determines whether the current form is referenced by the specified related item (a special rule). |
relatedFormItem — any, required: item identifier in Related Form (replaced by system with actual association status value) |
boolean:
|