If-Then-Else

A transformer for simple if-then-else logic.

javascript · Filters And Transformers

Details

IDIf-Then-Else
Languagejavascript
From Version5.0.0
Tagstransformer general

README

A transformer for simple if-then-else logic.

Script Data


Name Description
Script Type javascript
Tags transformer, general
Cortex XSOAR Version 5.0.0

Inputs


Argument Name Description
value The value to evaluate
equals (Deprecated) If value equals this
then Return this value if ‘condition’ is true
else Return this value if ‘condition’ is false
condition The condition expression to evaluate such as lhs==rhs or lhs!=rhs. Will evaluate as value==rhs if left empty for backward compatibility.
lhs The value to compare in the condition (left hand side)
rhs The value to compare in the condition (right hand side)
options Option flags (comma separated list): available options are `case_insensitive`, `regex_dot_all`, `regex_multiline`, `regex_full_match`, `input_data_type:then=<type>`, `input_data_type:else=<type>`, `input_data_type:lhs=<type>` and `input_data_type:rhs=<type>`. Choose `value`, `json` or `raw` for <type>.
lhsB The value to compare in the second condition (left hand side)
rhsB The value to compare in the second condition (right hand side)
conditionB The second condition expression to evaluate such as lhsB==rhsB or lhsB!=rhsB. Will evaluate as value==rhsB if left empty for backward compatibility.
conditionInBetween The condition to put between the first condition (lhs and rhs) and the second condition (lhsB and rhsB)
optionsB Option flags (comma separated list): available options are `case_insensitive`, `regex_dot_all`, `regex_multiline`, `regex_full_match`, `input_data_type:then=<type>`, `input_data_type:else=<type>`, `input_data_type:lhs=<type>` and `input_data_type:rhs=<type>`. Choose `value`, `json` or `raw` for <type>.

Outputs


There are no outputs for this script.

commonfields:
  id: If-Then-Else
  version: -1
name: If-Then-Else
script: ''
type: javascript
tags:
- transformer
- general
comment: A transformer for simple if-then-else logic.
enabled: true
args:
- name: value
  description: The value to evaluate
- name: equals
  description: (Deprecated) If value equals this
- name: then
  description: Return this value if 'condition' is true
- name: else
  description: Return this value if 'condition' is false
- name: condition
  auto: PREDEFINED
  predefined:
  - lhs===rhs
  - lhs!==rhs
  - lhs==rhs
  - lhs!=rhs
  - lhs>rhs
  - lhs>=rhs
  - lhs<rhs
  - lhs<=rhs
  - lhs=~rhs
  - lhs in list rhs
  - lhs not in list rhs
  - value===rhs
  - value!==rhs
  - value==rhs
  - value!=rhs
  - value>rhs
  - value>=rhs
  - value<rhs
  - value<=rhs
  - value=~rhs
  - value in list rhs
  - value not in list rhs
  description: The condition expression to evaluate such as lhs==rhs or lhs!=rhs. Will evaluate as value==rhs if left empty for backward compatibility.
- name: lhs
  description: The value to compare in the condition (left hand side)
- name: rhs
  description: The value to compare in the condition (right hand side)
- name: options
  description: 'Option flags (comma separated list): available options are `case_insensitive`, `regex_dot_all`, `regex_multiline`, `regex_full_match`, `input_data_type:then=<type>`, `input_data_type:else=<type>`, `input_data_type:lhs=<type>` and `input_data_type:rhs=<type>`. Choose `value`, `json` or `raw` for <type>.'
- name: lhsB
  description: The value to compare in the second condition (left hand side)
- name: rhsB
  description: The value to compare in the second condition (right hand side)
- name: conditionB
  auto: PREDEFINED
  predefined:
  - lhsB===rhsB
  - lhsB!==rhsB
  - lhsB==rhsB
  - lhsB!=rhsB
  - lhsB>rhsB
  - lhsB>=rhsB
  - lhsB<rhsB
  - lhsB<=rhsB
  - lhsB=~rhsB
  - lhsB in list rhsB
  - lhsB not in list rhsB
  - value===rhsB
  - value!==rhsB
  - value==rhsB
  - value!=rhsB
  - value>rhsB
  - value>=rhsB
  - value<rhsB
  - value<=rhsB
  - value=~rhsB
  - value in list rhsB
  - value not in list rhsB
  description: The second condition expression to evaluate such as lhsB==rhsB or lhsB!=rhsB. Will evaluate as value==rhsB if left empty for backward compatibility.
- name: conditionInBetween
  auto: PREDEFINED
  predefined:
  - and
  - or
  description: The condition to put between the first condition (lhs and rhs) and the second condition (lhsB and rhsB)
- name: optionsB
  description: 'Option flags (comma separated list): available options are `case_insensitive`, `regex_dot_all`, `regex_multiline`, `regex_full_match`, `input_data_type:then=<type>`, `input_data_type:else=<type>`, `input_data_type:lhs=<type>` and `input_data_type:rhs=<type>`. Choose `value`, `json` or `raw` for <type>.'
scripttarget: 0
isllm: false
runas: DBotWeakRole
fromversion: 5.0.0
tests:
- IfThenElse-Test