Adding data

Explains how to add a data file to an OPL project and fill it with data.

This part of the tutorial assumes you have created a project and the model is not empty.

You can add more than one data file to a project or run configuration. If you do so, the order of the data files is meaningful. See Ordering files within a run configuration. You can either add existing data files or create them as you add them. In this tutorial, you are going to add two existing data files to your project.

Note:
  1. A data file does not appear in the project tree until you add it to a project.

  2. All files pertaining to the same project must be stored within the same parent project directory.

To add a data file to the project:

  1. Select File > Copy Files to Project to display the Import window.
  2. Navigate to the directory: <Install_dir>\opl\examples\opl\production
  3. Select product.dat and productn.dat.
    Import window to copy files to a project
  4. Browse to select a folder to import into and click OK.
    “Import into Folder” window
  5. Click Finish in the Import window.

    The data file is added to the project but is not automatically added to the run configuration. You will do this later, as described in Populating and executing the run configuration.

    Note:

    You could also drag the data files file from Windows Explorer into the OPL Projects Navigator, and drop them in the myFirstProject project folder.

  6. Your OPL Projects Navigator should now look like this:
    Figure 1. Adding data files to a project
    A project to which data files have been added.

You are now going to execute your project. Later, you will modify the settings file so that you can use it to execute different run configurations of your project (see Creating and executing a different configuration).