Create Contexts
A context is a collection of one or more key-value pairs with an optional result field. Each pair is called a context entry. The key attribute within a context entry acts as an identifier to its corresponding value attribute.
You can use a context to collectively document all decision logic related to a particular scenario or entity. Say you need to determine the loan eligibility of an applicant, based on the applicant’s net monthly income and expense. For this purpose, you can create a decision named Loan Eligibility using the Context notation and add expressions or logic for gross monthly income, monthly expense, and net monthly income. Then, you can add a result field (within the context) that evaluates the net income and expense for loan eligibility. The result field can be a boxed expression that contains logic using the keys specified in the context.
Note:
If you add a function as one of the context entries, the context as a whole doesn’t return a result. However, you will still be able to invoke results of individual context entries throughout the decision model.The following image shows a context with a result field that determines the total income of applicants:
The output of the result field is the context’s output. In this case, the context returns the result of the boxed expression. You can reference the context’s result in other decisions within the model using the context name (for example, Total Income).
The following image shows contexts with and without a result field, and a boxed expression referencing a context and a context entry to determine the loan eligibility of applicants:
The output of this context returns a true or false decision that is based on evaluating the contexts. To reference a particular context entry from another decision, use the format ContextName.EntryKey (for example, Income.Salary). Within a context, an entry can only reference entries that are above it.