條件式指令(if, then, else) section_cdz_lsk_w3b

進階編輯器支援條件式指令(if, then, else)。 它可讓您定義更複雜的運算式。 它由下列元素組成:

  • if:要先評估的條件。
  • then:條件評估結果為true時要評估的運算式。
  • else:條件評估結果為false時要評估的運算式。
NOTE
所有運算式都必須加上括弧。
if  (<expression1>)
then
   (<expression2>)
else
   (<expression3>)

<expression1> 必須傳回 布林值.

<expression2><expression3> 必須有相同型別或相容型別。 支援的簽章和傳回的型別包括:

boolean,boolean : boolean
dateTime,dateTime : dateTime
dateTimeOnly,dateTimeOnly : dateTimeOnly
decimal,integer : decimal
integer,decimal : integer
integer,decimal : decimal
duration,duration : duration
string,string : string
listBoolean,listBoolean : listBoolean
listDateTime,listDateTime : listDateTime
listDateTimeOnly,listDateTimeOnly : listDateTimeOnly
listDateOnly,listDateOnly : listDateOnly
listDecimal,listDecimal : listDecimal
listInteger,listInteger : listInteger
listString,listString : listString

使用狀況

條件式指示可讓您透過減少條件活動的數量,將歷程工作流程最佳化。 例如,在相同動作活動中,您僅能使用一個條件運算式,即可為欄位定義指定兩個替代方案。

動作活動的範例(適用於預期字串為條件指令結果的欄位):

if (startWithIgnoreCase(@{eventiOSPushPermissionAllowed.device.model}, 'iPad') or startWithIgnoreCase(@{eventiOSPushPermissionAllowed.device.model}, 'iOS'))
then
   ('apns')
else
   ('fcm')
recommendation-more-help
4f4a00c1-77c9-4eee-84df-bbe6206c3ab9