Creating Declare Expression rules
Create Declare Expression rules to automatically calculate values in your application. Declare Expression rules take advantage of values that exist in your system to calculate values of target properties. As a result, you increase automation of calculations in your application.
For example, in an online shopping order, an application can automatically calculate the tax value based on prices of the items and the information that tax equals a specific percentage of the item price. By implementing Declare Expression rules, the application recalculates the tax value every time the customer updates the shopping order.- In the header of Dev Studio, click .
- In the Target Property field, enter a property that you want to
calculate, preceding the property name with a period.
For example: For the TaxValue property, enter .TaxValue. - Optional: To restrict search for the result of the declare expression to a specific page, in the
Page Context field, enter a data page that stores available
results.
For example: To situate a target property on the .pyItemNames() embedded page, enter .Invoices.pyOrders().pyItems().pyItemNames(). Leave the parentheses blank because a declare expression applies to all elements on a page. For more information, see Data pages overview. - In the Context section, select the application layer in which you want to store the rule.
- In the Apply to field, enter the class that stores the target
property.
Note: When you create a declare expression, you can first provide the class, and then provide the target property in the Target Property field. If you select a class first, the system limits the available target properties to the properties that the selected class stores. - In the Add to ruleset field, enter a ruleset to store the rule.
- Click Create and open.
Previous topic Declare Expression rules Next topic Defining expressions in Declare Expression rules