Calculating values with decision tables
To deliver an application that automatically at run time provides the most appropriate solutions, create logic with decision tables. Decision tables test a group of properties to match specified conditions and ultimately improve the flexibility of your application. By creating decision tables by using the low-code App Studio environment, you deliver software that can respond dynamically to varied conditions in business processes.For example, you can create a decision table that calculates the account type for a customer based on a declared monthly income. The decision table returns a Standard account type for the income between 2,000 and 4,000 dollars, a Premium account type if the income is between 4,001 and 8,000 dollars, and a Gold account type for customers with income between 8,001 and 12,000 dollars.
- If you want to reuse a decision table that already exists in Dev Studio, mark the decision table as a relevant record. For more information, see Marking a record as relevant.
- Create a calculated field for which you want to return results with a decision table. For more information, see Creating a calculated field.
- Ensure that your application uses Cosmos React. For more information, see Enabling for an application.
In the navigation pane of App Studio, click Data.
In the Data model section, click View.
Open the calculated field:
- To open a field form a case type data model, in the Case types section, click the case type that includes the field that you want to edit.
- To open a field from a stand-alone data object, in the Data objects section, click the data object that includes the field that you want to edit.
In the Fields list, click the Properties icon in the row of the calculated field that you want to edit.
In the Configure field dialog box, expand the Advanced section, and then, in the Calculation section, select Use decision table.
Define a decision table that you want to use:
- To create a new decision table, in the list of options, select
Custom decision table, click the
Properties icon, and then define the table.
For more information about creating decision tables for calculated fields, see Authoring decision tables in App Studio.
- To reuse a decision table, in the list of options, select Existing decision table, and then, in the list of decision tables, select the table that you want to use.
- To create a new decision table, in the list of options, select Custom decision table, click the Properties icon, and then define the table.
Close the field configuration dialog box by clicking Submit.
Navigate to the calculated field:
Associate the field with a decision table
ArticleAbout Decision tables