How to use "If~Then~Else" in Converters and Expressions on DS

Follow

・Overview
 We will explain how to use the conditional branch expressions "If ~ Then ~ Else" in converters and expressions on DS.

・Details
  There are differences between using the "If Then" format and using the "If-Then-Else" format when executing conditional branching based on "If~Then~Else".

【Example】

 If ”A” is included in the character string of the variable "text", output ”B", else output ”C”.

■Using "If Then" in Converters
 In Converters, select: Other > If Then


1.png
(Figure1."If Then" in Converters)

 Select "If Contains" after clicking the Add button.
2.png
(Figure2.Selecting a condition for "If Then")

 Specify a condition and a process.
3.png
(Figure3.Specifying a condition for "If Then")
 
■Using "If-Then-Else" in Expression
 Select: Expression → Operators → If-Then-Else.
4.png
(Figure4.Expression)

 Write the condition and the processing in the following format.

  b  ?  e1  :  e2   ( [ Boolean expression ]  ? [  Expression 1 ]  :  [ Expression 2 ])

 If the value of the Boolean expression is True, the output will be e1, but if it is False, the output will be e2.

 If you want to set "If Contains" as you did for Converters, but this time in the Expression field, select "Contains: contains (source, text)" in "Functions".
5.png
(Figure5."IfThenElse" in Expression)

An error will occur if you use the "If ~ Then ~ Else" format in Expression. Please be careful when using conditional branching either with converters or expressions.

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.