Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Creating Declare Expression rules

Updated on May 31, 2022

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.
  1. In the header of Dev Studio, click CreateDecisionDeclare Expression.
  2. 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.
  3. 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.
  4. In the Context section, select the application layer in which you want to store the rule.
  5. 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.
  6. In the Add to ruleset field, enter a ruleset to store the rule.
  7. Click Create and open.
What to do next: Define a declare expression. For more information, see Defining expressions in Declare Expression rules.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us