Excel scenario file template sample details

You use the samples console to run this sample.

Running this sample

To run this sample:

  1. Switch to the Samples Console perspective.

  2. In the Samples Commands view, navigate to Samples Commands > Decision Center > Excel scenario file template.

    Tip:

    To open the Samples Commands view, you can click the View sample commands link in the Samples and Tutorials view.

  3. Execute the run command to compile and run the application.

    The command creates a new Excel file named loanvalidation.xls with 60 scenarios.

    Note:

    If you want to change the number of scenarios, edit the property scenarioCount in <InstallDir>/teamserver/samples/dvscustompopulate/build.xml

  4. Open the generated Excel file <InstallDir>/teamserver/samples/dvscustompopulate/populateExcel/data/loanvalidation.xls to check its contents, and then close Excel.

To use the Excel scenario file:

  1. Sign in to Decision Center: http://localhost:<PORT>/teamserver.

    Use the following role:

    • Username: rtsUser1

    • Password: rtsUser1

  2. Switch to the loanvalidation-rules project.

  3. On the Explore tab, click the Simulations smart folder, select the PopulateSample simulation, and then click Edit.

  4. Click Step 3: Scenarios. Ensure that Excel (2003) is selected as the format. Click Browse and select <InstallDir>/teamserver/samples/dvscustompopulate/populateExcel/data/loanvalidation.xls.

  5. Click Finish and Run.

  6. Select Sample as the server and then click Run.

    This command runs the simulation. It might take a few seconds.

How this sample works

To populate an Excel scenario file template using the API, the ExcelPopulate.populateExcelFile method, you require:

Population of the scenario file with scenarios is performed by an IlrExcel2003ScenarioSuiteWriter, which is created from an IlrExcel2003ScenarioSuiteWriterFactory.

To add each scenario to the file, specify the following parameters:

The IlrExcel2003ScenarioSuiteWriter writes all the scenarios in an output stream using the write function.

Note:

The generated template contains one empty row which you must remove to have a usable populated Excel scenario file. A template without this extra row requires a custom scenario provider. A custom scenario provider is not the focus of this sample, and therefore, this sample does not show how to generate a template with 0 default rows. For more information about how to do this refer to Sample: Custom scenario providers and parallel execution.

Source files

The source files for this sample are located in <InstallDir>/teamserver/samples/dvscustompopulate/populateExcel/src/ilog/rules/dvs/samples/custom.

You can also view and modify the sample source files in Rule Designer. To import the sample into your workspace, click the Import projects link in the Samples and Tutorials view, and switch to the Java perspective.