new ArchActionSwitch(coreSwitchActionViewModel)
The Architect Scripting class for the Switch action.
Instances of this action should be created by calling ArchFactoryActions#addActionSwitch
Parameters:
| Name | Type | Description |
|---|---|---|
coreSwitchActionViewModel |
Object | ( Internal ) an Architect core switch action view model. |
Extends
Members
-
static, readonly displayTypeName :string
-
Returns the display type name string 'ArchActionSwitch'.
-
readonly caseCount :number
-
Returns the current case count on the switch action not including the Default case.
-
readonly caseCountMax :number
-
Returns the maximum number of cases allowed in a switch action not including the Default case. The value is 64.
-
readonly caseCountMin :number
-
Returns the minimum number of cases allowed in a switch action not including the Default case. The value is 1.
-
readonly evaluationStyle :string
-
The evaluation style to use on the switch action. The string values in
ArchEnums#SWITCH_EVALUATION_STYLESlists valid values. -
readonly isArchActionSwitch :boolean
-
Returns true indicating that this action is an ArchActionSwitch instance.
-
readonly outputDefault :ArchActionOutput
-
The Default output for this action
- Inherited From:
-
readonly switchDataType :ArchDataType
-
The data type that will be used to switch on for the action. This is determined from the expression set on the
ArchActionSwitch#setExpressionSwitchfunction. Can be null.
Methods
-
addCase() → {ArchBaseValue}
-
Adds a case to the switch action and returns the value associated with the case.
Returns:
ArchBaseValue -
deleteCaseByIndex(index)
-
Deletes a case from the switch action at the specified index.
Parameters:
Name Type Description indexnumber the zero based index of the case to delete. This value should be a non-negative integer. For example: for Case 1, pass in 0.
-
getCaseValue(index) → {T}
-
Returns the Architect value associated with the switch case at the specified index. The value's type will match the
ArchActionSwitch#switchDataTypetype.Parameters:
Name Type Description indexnumber the zero based index of the case to retrieve. This value should be a non-negative integer. For example: for Case 1, pass in 0.
Returns:
T -
setExpressionSwitch(expressionText, caseExpressionOrExpressionsopt) → {ArchDataType}
-
Sets the evaluation style to 'matchExpression' and determines the data type to switch on at runtime based on the resulting type of the passed in expression.
Parameters:
Name Type Attributes Description expressionTextstring the value to switch on at runtime. For example, if the expression is Flow.MyIntegerVar and Flow.MyIntegerVar is of type integer, then the value to switch on will be of type integer the case values will also be of type integer. The resulting data type of the expression text must be a script creatable data type.
caseExpressionOrExpressionsstring | Array.<string> <optional>
if a string, the expression to set on each case in the switch action. If a string array, the switch action will be configured to have one case for each string in the string array. If there are no strings in the array, one case statement will be present configured to no value. If an item in the string array is null or undefined, that specific case will be configured to be no value. The maximum number of items allowed is available from the
ArchActionSwitch#caseCountMax.- See:
-
- ArchDataType.isScriptCreatableForFlowType
-
setFirstTrueSwitch() → {ArchDataType}
-
Sets the evaluation style to 'matchFirstTrue' and sets the data type to switch on to be Boolean with a switch value of true. The first case value that evaluates to true will be taken at runtime. If none of the cases evaluate to true, the default output will be taken. This action will set all of the cases to have a value of false by default.