Nullable Variable Value Model
The value model describes an optional variable. This is not a definition of a variable, but this is a choice of an existing variable. You can specify the type of the variable.
Example
Check the Editors Example.
Configuration
import { createNullableVariableValueModel } from 'sequential-workflow-editor-model';
builder
.property('foo')
.value(
createNullableVariableValueModel({
variableType: 'string',
isRequired: true
})
);
Required properties:
variableType
- the type of the variable, for examplestring
,number
orboolean
.
Optional properties:
isRequired
- if this property istrue
then a user must select a variable. By default this property isfalse
.
Value Reading
The value is stored in a simple object:
interface Variable {
name: string;
}
type NullableVariable = Variable | null;
To read the value you need to read the property value:
import { NullableVariable } from 'sequential-workflow-editor-model';
const value: NullableVariable = stepOrRoot.properties['foo']; // null or { name: '...' }