Bixby Developer Center

References

validate

optional

Lists validation rules for an input or variable. Each validation rule is a condition and an effect that is applied if the condition holds true.

Example

action (ValidateInputs) {
type (Search)
description (Show how to use validate.)
collect {
input (integer) {
type (Integer)
max (One)
min (Required)
validate {
if (integer == 101) {
halt {
dialog ("Halting because you entered 101.")
}
}
if (integer == 42) {
replan {
dialog ("Using replan to change integer to 0, because you entered 42.")
intent {
goal: Integer
value: Integer (0)
}
}
}
if (integer > 9) {
prompt {
dialog ("Please provide an integer smaller than 10.")
}
}
}
}
}
output (Result)
}

View master on GitHub

For a complete example with input validation, see the Input Validation and Error Handling sample capsule.

Child Keys

halt
optional
Halts execution of the action with the invalid input and displays an error message
prompt
optional
A prompt to ask for a new value for the invalid input
replan
optional
Changes the plan during execution to a new intent after an optional dialog event
unlock
optional
Pauses execution if device is locked and informs users they need to unlock their device to continue