Data Transform form - When, Otherwise, and Otherwise When actions
Usage
Use the When, Otherwise, and Otherwise When actions to conditionalize data transform actions, so that the system invokes the actions only when the specified conditions are true.
For example, given an ordering process with a form where customers can select a check box
to indicate whether their billing address is the same as their shipping address, you can use
a When action to tell the system to perform a set of actions (children actions of the When)
when that check box is selected ( BillAddressSameAsShipping
property is
true). By using an Otherwise action after the When action, you can specify another set of
data transform actions to take if the check box is not selected.
In the list of rows on the Definition tab, an Otherwise When action row must be preceded by a When action row at some point in the list. An Otherwise action row must be preceded by either a When action row or an Otherwise When action row.
Example
In the following example, if the user selects Billing address same as shipping
address check box in the order form, the property
BillingAddressSameAsShipping
is set to "true". In that case, the data
transform actions following the When action specify to update the
pyWorkPage.pyWorkParty(Customer).BillingInformation
page using the
Address value from the pyWorkPage.pyWorkParty(Customer).ShippingInformation
page (that is, use the shipping address for the billing address). If the check box is not
selected, the children actions of the Otherwise action specify to set the billing
information page values to null strings, so that the user has to enter the data.
When pyWorkPage.pyWorkParty(Customer).BillingAddressSameAsShipping == "true"
Update Page pyWorkPage.pyWorkParty(Customer).BillingInformation with values from pyWorkPage.pyWorkParty(Customer).ShippingInformation
Set .Address equal to .Address
Otherwise
Update Page pyWorkPage.pyWorkParty(Customer).BillingInformation
Set .Address equal to ""
Relationship settings
The When, Otherwise, and Otherwise When actions have no settings for the Relation field.
Supported features
You can use the following items in the rows for the When and Otherwise When actions:
- When condition rules
- Expressions
Primary
keyword
Restrictions
Do not use <
or >
in an expression. Use
<=
or >=
instead.
Previous topic Data Transform form - Update Page action Next topic Configuring the JSON data transforms settings column on the Data Transform form