Begin relevant processing in your application only under specified conditions by creating a circumstance definition. When you implement circumstancing in your application, you provide flexible solutions without defining complex logic. As a result, you increase efficiency and design an application that is easier to maintain in the future if your business requirements change.For example, in a banking application, if your circumstance template includes a LoanAmount property, and the definition includes the value 5000 with an operator >, the application resolves the circumstance rule only when the loan request amount is greater than 5000.
- In the header of Dev Studio, click Create Technical Circumstance Definition .
On the Create Circumstance Definition form, enter values in the
fields to define the context of the definition:
- In the Label field, enter text that describes the purpose of the circumstance definition.
- Optional: To change the default identifier for the circumstance definition, click Edit, and then in the Identifier field, provide a unique value.
- In the Template Name field, press the Down arrow key, and then select the circumstance template that your circumstance definition implements.
- In the Context section, select the application to store the template.
- In the Apply to field, press the Down arrow key and select the class that defines the scope of the circumstance definition.
- In the Add to ruleset field, select the name and version of a ruleset that stores the circumstance definition.
To override the default work item that your application associates with this
development change, in the Work item to associate field, press
the Down arrow key, and then select a work item.
For more information about your default work item, see Setting your current work item.
- Click Create and open.
On the Definition tab, click the column header to choose which
operations the column supports:
- For columns that evaluate properties from the template against a single value, select an operator from the Use Operator list, for example >.
- For columns that evaluate properties from the template against a range of values, select the Use Range check box, and then choose operators from the Starting Range and End Range lists, for example >= and <=.
- Click Save.
- Click a cell in a table that you want to define, and then enter a value or an expression that evaluates properties in the template. For example: To evaluate loan amounts greater than 5000, use a single operator >, and then enter 5000.
To provide more values for evaluation, add rows to the table:
Tip: As your application evaluates the table from top to bottom, to save time and resources, place the most likely outcomes at the top of the table.
- To add a row before the current cell, on the toolbar, click Insert Row Before, and then repeat step 6.
- To add a row after the current cell, on the toolbar, click Insert Row After, and then repeat step 6.
- Optional: To ensure that your application can process the table, check the table for conflicts by clicking Show conflicts on the toolbar. Result: A warning icon appears in rows that are unreachable or empty.
- Click Save.
- Date circumstance rule
A date circumstance rule is a circumstance that is only resolved during a specified range of time.
- Circumstance rule examples
Assume that you have different pricing levels for your customers. You first define a base pricing rule for all customers. Then you qualify the base rule by creating circumstanced rules for customers at different buying levels. The property .CustomerType is part of the customer order and has values of "Silver" and "Gold". In this example, a customer has purchased a $100 item. Using the property and values, you create circumstanced instances of the base rules as shown here:
- Circumstance definitions
A circumstance is an optional qualification available for supported rule types and is built upon the base rule.
- Date combinations and business requirements
The following table lists the possible date combinations and the business-logic requirements they meet when you circumstance by date.
- Changing the scope of rules
- Setting rule status and availability
- Creating a rule
- Building logic and calculating values in your application