Example: Decision Tables Using Collections and Variables in the Inputs

Decision Tables using Collections and Variables in the Inputs

Overview

Intended audience: Process designers, Web designers

Tags: Decision Table; Request Variables; Magic Variables; Collections; Mustache Syntax

This example shows Decision Table Inputs calling Collections through mustache syntax. And you can call specific rows and fields delimited by dots.

This example also shows Decision Table Inputs calling Request variables and Magic variables through mustache syntax.

This example compares a loan ratio, which is stored in a Request variable with credit scores, that are stored in a Collection. Then, this Decision Table rates a loan ratio and credit scores to see if lenders are creditworthy for a loan.

Follow these steps to add a Decision Table:

  1. To use the Decision Table with a variable, create an Environment Variable called loanRatio that works on a Screen to enter data.

  2. Import the Collection fico_scores.json, which is at the end of this example. It has data about credit scores, which is on the page MyFico.

  3. Import the Decision Table Decision Table v4.json, which is at the end of this example. The editor displays the imported Decision Table.

    It displays the following:

    • The input Borrower Credit Score, which conditions the number score from the Collection FICO Score that has been previously imported. The Collection is called using mustache syntax, calls the row number, and the Collection field score.

    • The input Front-End Ratio conditions the variable loanRatio by entering mustache syntax and selecting the variable.

    • According how the Inputs rate, the Borrower Rating output displays features for lenders and its creditworthiness.

  4. Test your Decision Table to see data outputs.

    1. On the left side of the Decision Table, Click Sample Input. The JSON data model for the Decision Table displays.

    2. Add the loanRatio object in the JSON model.

    3. Enter values as follows:

      {
         "creditScore": 800,
         "ratio": 0.20,
         "loanRatio": 0.31
      }
    4. Click Run.

    5. If the Decision Table evaluates successfully, its output displays in the Output panel‌ as follows:

Last updated

© Copyright 2000-2024 ProcessMaker Inc. All rights reserved.