Task 4: Using domains with the Excel scenario file

You add domain values to the Excel scenario file.

About this task

In this task, you add selectable domain values for the type of property of the borrower, and see the effect in the generated Excel scenario file. Then, you add another value to the domain in both Rule Designer and the existing Excel scenario file.

Step 1: Adding domain values to the Excel file

You add domain values for the property type argument.

Procedure

  1. In the Rule Explorer, double-click the Borrower class (loanvalidation-rules > bom > model > loan > Borrower).
  2. In the Members area, double-click the propertyInfo member.
  3. In the Domain part, click Create a domain.
  4. In the Domains wizard, select Literals as the domain type, and then click Next.
  5. Click Add, and then type Condominium.
  6. Click Add again and type Private House.
  7. Click Finish. Save your changes by using the save button in the Eclipse toolbar.

Step 2: Generating the Excel scenario file template

You generate the Excel scenario file template.

Procedure

  1. In the Rule Explorer, right-click the loanvalidation-rules project, and then click Testing and simulation > Generate Excel Scenario File Template.
  2. Keep the default options as you did in the previous tasks.
  3. On the Expected Results page, expand the loan report, select approved and first message, and then click Next.
  4. Click Finish.
  5. In the Rule Explorer, double-click testsuite.xlsx to open it.
  6. Select the property info cell in the Scenario 1 row. Click the arrow beside the cell to see the two values that you added in the domain.
  7. Close testsuite.xlsx.

Step 3: Adding a new domain value in Rule Designer:

Now you want to add a new value to the domain. You must first add it in Rule Designer. Then, you can either regenerate the Excel scenario file template or edit the scenario file directly if it is already populated with data.

Procedure

  1. In the Rule Explorer, double-click the Borrower class (loanvalidation-rules > bom > model > loan > Borrower).
  2. In the Members area, double-click the propertyInfo member.
  3. In the Domain part, click Edit the domain.
  4. In the Domains wizard, click Add and enter Semi-detached.
  5. Click Finish, and then save your changes.

Step 4: Adding the domain value in the existing Excel file

To add or remove domain entries manually in an existing scenario file, you must delete the named range, add the domain entries, and then redefine the named range.

Procedure

  1. Double-click testsuite.xlsx to open it.
  2. Unhide the _domains worksheet:
    1. Click Home > Format > Hide & Unhide > Unhide Sheet.
    2. Select _domains.
    3. Click OK.
  3. Delete the named range for domainA:
    1. Click Formulas > Name Manager.
    2. In the Name Manager window, select domainA, as shown in the following figure:
      Image shows the relationship between the named range and the column letter.
    3. Click Delete.
    4. Click OK to delete the domain
    5. Click Close to close the Name Manager window.
  4. Click the _domains worksheet and locate column A, which contains the values Condominium and Private House.
  5. To insert the new value in the correct location:
    1. Right-click the Private House cell and click Insert.
    2. Type the value Semi-detached in the new cell.
  6. Redefine the named range for domainA:
    1. Select all the values for domainA (Condominium, Semi-detached, Private House).
    2. Type domainA in the Name box, as shown in the following figure:
      Image shows the range selected and name entered in Name box.
    3. Press Enter.
  7. Click Home > Format > <Visibility > > Hide & Unhide > Hide Sheet.
  8. Save your file.
  9. Select the PropertyInfo sheet and click the property type cell in the PropertyInfo 1 row. The new Semi-detached value is available.

Results

You have completed the tutorial. It showed you how to edit the BOM to customize the generated Excel scenario file template for testing decision services.