- Create a Switch Rule in the Ruleset editor.
- Select the Switch Rule, and then use the Rule tab in the Properties view to map source data.
- Create and define new Cases and/or Case conditions.
- Add Methods to each Case.
Create Switch Rules
Use the New Switch option that is available as part of the toolbar in the Rule section of the Ruleset editor. A Switch Rule requires at least one Case. By default, a Switch Rule is created with one Case and new Cases are created with a Type Guard of Object.
To add Cases to a Switch Rule:
- Select the Switch Rule;
- Right-click and select Add New Case.
Use tabs in the Properties View
The Properties view displays different options based on the Case in the Switch Rule that is selected in the Rules section. This is how you can view and define rules, conditions, and other properties.
Type Guard (tab): In this tab, you can set the Type Guard by clicking the Select Subtype button (). This will display the fully qualified names (FQN) of the Subtypes available for the Type of the element mapped in the Switch Rule. If a Condition has been added to the Case, the Remove Type Guard button will be enabled; allowing you to remove the Type Guard from the selected Case.
Condition (tab):This tab is similar to the Condition tab in Simple and Composite Rules. It allows you to map a Conditional Action to the Case, or remove it from the selected Case if a Type Guard is also provided.
Method (tab): This tab is used to map a Method to a Case in a Switch Rule. You can drag and drop a Method from the Methods pane of the Ruleset editor. After a Method is selected, you can also use this tab to map the Method’s input.
All Method parameters are defined as input, which is slightly different from other Rules in that this allows you to map from the Target schema to the targetParm input (if a Target exists for the Method). Since the targetParm input parameter is a mapping from the Target schema, the editor marks it with by a cross-hair icon ( ).
For more information, see Creating Methods for use in a Ruleset.
Create and define Cases
- New Case: adds a new Case Rule to your Switch Rule.
- Add/Remove Case Condition: adds or removes a conditional action to the selected Case.
- Add/Remove Case Method: displays any existing method that can be added to or removed from your Case.
Add Methods to Cases
- Select the Case;
- Right-click and select Add Case Method, which provides a list of existing Methods. Another option is to drag the specific method from the Methods pane onto the Case or, into the Method tab of the Properties view.
Note: This is described above in the Method tab topic, as well as in Defining Rules using Actions, Variables, and Methods.
Please sign in to leave a comment.