Using the Data Model Wizard

This chapter describes how to use the Data Model Wizard.

This chapter covers the following topics:

About the Data Model Wizard

The Data Model Wizard helps you perform the following related tasks:

Note: Some of these tasks can be performed elsewhere in the Business Modeler. The Data Model Wizard, however, is the only tool that lets you specify certain basics such as the sales date, and quantity, and base time bucket.

Before Using the Data Model Wizard

Before you use the Data Model Wizard, be sure to do the following:

Getting Started with the Data Model Wizard

A new data model can be based on an existing template or on an empty template. Note that a data model cannot be converted into a template.

To start to build the data model

  1. Click Data Model > New Data Model.

    The Create Data Model/Template screen appears.

  2. Click the Data Model or Template button radio button.

  3. Click OK.

  4. Click Next.

    The wizard prompts you for basic information about this data model.

  5. Specify a unique name and an optional description.

  6. Click Next.

    The wizard prompts you to specify the time unit for this data model.

    the picture is described in the document text

  7. For Time Bucket, select one of the following base time units: Day, Week, or Month.

  8. If you selected Weekly, fill in the other fields as follows:

    First Day of Week Select the day of the week to use as the first day of any week. For example, if you select Monday, then all weekly data will be aggregated and displayed on the Monday of each week.
    (Monthly time units are always aggregated on the first day of the month).
    Aggregation Method Select how to aggregate data in time, either backward or forward. Oracle recommends that you select Backward to start of previous week, so that the data will be aggregated to the beginning of the previous week. For example, all the sales records of the week June 07 to June 13 will be aggregated to June 07.
    Monthly time units are always aggregated backwards to the first of every month. For example, sales for June will be aggregated to June 01.

    Note: The settings you choose here also apply to integration. See “Series and Level Integration”. Note that the Data Model Wizard is the only place where you can specify these settings.

  9. Click Next.

    The wizard next prompts you for information about the source data. See “Describing the Staging Tables”.

Describing the Staging Tables

If your sources are text files, the Data Model Wizard helps you map them into staging tables. If your sources are database tables, your tables are the staging tables. In either case, the wizard helps you describe the contents of the staging tables so that you can build a model on them.

To describe the staging tables

  1. In the Select Source Combination dialog box, you specify the number of source tables or files that you will use, as follows:

    Single Table Contains sales, items, and locations in a single file.
    Two Tables Contains sales and locations in the first file and items in the second file.
    Three Tables Contains sales, locations, and items in three separate files.
  2. Click Next.

    The Data Model Wizard now displays the Tables or Text Files as Sources dialog box.

  3. Specify whether the source data is in tables or text files:

    Oracle Tables Click if the data is in database tables.
    Text Files Click if the data is in text files.
  4. Click Next.

  5. The next step depends on whether the data is in the database or in text files:

    • If the source data is in the database, the wizard now displays the Choose User Defined Source Tables dialog box. This dialog box varies, depending on the number of source tables you specified. The tables shown in drop-down lists depend on what you have previously loaded into the Demantra database.

      the picture is described in the document text

    For example, if your source is in three tables, fill in the fields as follows and then click Next:

    Sales file definition Select the file where the sales history data is stored.
    Location file definition Select the file where the location data is stored.
    Item file name Select the table where the item data is stored.
    • If the source data is in files, the wizard now prompts you for information about the format of those files, and how to map the data into database staging tables. See “Specifying the Structure of the Staging Tables”.

  6. The next step depends on whether you specified multiple sources:

    • If you specified multiple tables or files, you must specify how to join them. See “Joining Multiple Source Files or Tables”.

    • If you specified only a single table or file, you are ready to define the data model. See “Defining the Minimal Required Data Model”.

Specifying the Structure of the Staging Tables

If you specified two or three tables or files, the wizard displays the Text File dialog box. Here, you describe each text file you are going to import, as well as the staging table that corresponds to that file. If you are using multiple source files, the wizard prompts you for information for each one, in a specific order.

To specify the structure of the staging tables

  1. Read the title bar of the dialog box to make sure you know which data you are mapping. For example, if the wizard is expecting item data, the title includes “item.”

  2. In the upper part of the dialog box, describe the source file that you are using for this data, as follows:

    File Directory The location of the files.
    Log Path Path and filename of the log file that will store any load errors.
    Delimiter Type Select the delimiter type from the drop-down list.
    Date Format Select the date format from the drop-down list. If this source file does not contain dates, this is optional.
    File Name Format Select more than one file through the use of a wildcard (*). For example, dcl_his*.* selects every file with the prefix dcl_his.
    Load Option Insert is the only option currently available.
    Column Delimiter Select the character used in this source file to delimit fields.
    No of lines to skip from begin If there is a header, this gives the number of lines to miss at the top of the table.
  3. In the lower part of the screen, define the table structure of the table you are defining in the staging area. To add a new entry to this information, right-click and then click Add. Fill in the details of the table structure as follows:

    Name Field name
    Type Data type for this field; specify one of the data types supported by the database.
    Width Maximum width of field
    Dec Decimal point
    Default The default value of the field if it is null in the source data.
    Null Click yes to allow field value to be null.
    From Position Use if Fixed was selected as the Delimiter Type. This is the position in the source text file where the field starts.
    To Position Use if Fixed was selected as the Delimiter Type. This is the position in the source text file where the field ends.
    Const Constant column width. If selected, the From Position and To Position fields are disabled for editing.
  4. When you are done describing this source file and its corresponding staging table, click Next. If you are using multiple source files, Business Modeler displays a similar dialog box where you specify the next source file.

  5. The next step depends on whether you specified multiple sources:

    • If you specified multiple tables or files, you must specify how to join them. See “Joining Multiple Source Files or Tables”.

    • If you specified only a single table or file, you are ready to define the data model. See “Defining the Minimal Required Data Model”.

    Note: This dialog box provides the following additional options:

    • The Create Load Batch button creates a batch file that will load the table. This button is only present in certain installations of the Business Modeler.

    • The Table Syntax button displays the SQL syntax used by the database and the Business Modeler to create the table in the staging area. Only experienced consultants should use this feature.

    • If you are using an Oracle database, Demantra uses the SQL*Loader tool (from Oracle) to load data. The Click CTL Syntax button displays the control file used by SQL*Loader. Only experienced consultants should use this feature.

Joining Multiple Source Files or Tables

If you specified two or three tables or files, the wizard displays the Join Sources dialog box. By defining the joins, you implicitly specify the primary keys in the data.

To join the source data

  1. For the first table or file to be joined, drag a field name from that table or file (on the left) to a blank space in the empty join structure on the right.

  2. For the other field or file to be joined, drag a field name from the other table or file (on the left) to the remaining blank space in the join structure.

  3. If you specified three tables or files as the source, you must create an additional join. To do so, right-click the right side of the dialog box and click New.

    A new, empty join appears in the right side.

    In the same way that you defined the previous join, create a join between the sales table and the remaining, non joined table.

    Note: While you are defining these joins, it may be helpful to toggle between the table descriptions and the table names. To do so, click the toggle button Show Table Description or Show Table Name.

    The result might look like this:

    the picture is described in the document text

  4. Click Next. The wizard now helps you define the data model. See “Defining the Minimal Required Data Model”.

Defining the Minimal Required Data Model

This section describes how to define enough of the data model so that you can save it for future work. Here you will declare the sales date and actual quantity, and you will define an item level and a location level; you can define these four things in any order. The following shows an example.

the picture is described in the document text

In this stage, you specify how to use the fields in the staging tables, generally using each field in a level definition or in a series definition.

Note: Demantra imports only the fields that you specify how to use.

Declaring the Sales Date

To declare the sales date

  1. In the left box, right-click and then click Create Sales Date.

  2. Select the table and field that contains the sales date for any given sale.

    For example, in src_rainbow_sales, the s_date field might contain the sales date for each sales record.

    the picture is described in the document text

Declaring the Sales Quantity

To declare the sales quantity

  1. In the left box, right-click and then click Create Sales Quantity.

  2. Select the table and field that contains the item quantity for any given sale. For example, in src_rainbow_sales, the orders field might contain the sales quantity for each sales record.

  3. In Series Title, specify a user-friendly name for this series.

  4. For Aggregate as, select the function to use when aggregating multiple records.

    the picture is described in the document text

Defining an Item Level and a Location Level

The data model must include at least one item level and one location level. The first levels you define should be at the lowest desired level of aggregation. The lowest item level usually corresponds to specific SKUs, and the lowest location level usually corresponds to specific stores or ship-to locations.

To define an item or location level

  1. In the left box, right-click and then click Create Location Dimension or Create Item Dimension.

  2. Then specify the level as follows:

    the picture is described in the document text

    1. In the Table Name field, click a source table from the drop-down list.

    2. In the Field Name field, click the field within that source table that stores the unique codes that distinguish the members of this level.

    3. In the Name field (in the Select Properties area), type a unique name of this level, for internal use.

      Demantra automatically uses this as the basis for the Internal table name, which is the table in which Demantra will store information for each member of this level. Within this table, the member codes will be stored in a field whose name is the Name that you specified.

  3. In the left box, right click the level and then click Create Description.

  4. Specify the level description as follows:

    the picture is described in the document text

    1. For Table Name, select the same table.

    2. In Field Name, select the field that stores the descriptions of the members of this level.

      If the source data does not include a specific field that you can use as the member descriptions, then just use the field that stores the member identifiers.

    3. In Level Title, type the name of this level, as it should be shown in the user interfaces.

    4. In Enabled Level, specify whether you want the level to be disabled. If the level is disabled, it is effectively removed from the data model. However, it can be reactivated if required later.

    5. To use the internal, autogenerated ID as the code display field, click the check box Use auto generated ID as code for filter. Otherwise, Demantra uses the code field as the code display field.au

Saving the Data Model

After defining the minimum required data model, you can save all the work that you have done within the Data Model Wizard. You can return and continue work later.

To save the data model

  1. Click Save.

  2. To exit the Data Model Wizard now, click OK. You can return later and continue your work.

Defining Additional Elements

This section describes how to define additional elements of the data model.

Declaring the Unit Price

The price per item is generally different at different locations and over time.

To declare the unit price

  1. In the left box, right-click and then click Create Item Price.

  2. For Table Name and Field name, select the table and field that contains the unit price for an item, at a given location and time. For example, in src_rainbow_sales, the orders field might contain the sales quantity for each sales record.

  3. For Unit Title, optionally modify the title, whose default is Price.

  4. For Aggregate as, select the function to use when aggregating the price of multiple items.

  5. If you selected wavg (weighted average), then specify a weight to use. For Dependent Field, select a field within the same table that Demantra should use as the weights.

    the picture is described in the document text

Defining a Unit of Measure

When you define a unit, you specify a set of conversion factors for that unit. The conversion factors can be different for different items.

Note: There must be a one-to-one relationship between the unit values and the members in the level where the unit is configured.

To define a unit

  1. In the left box, right-click and then click Create Unit.

  2. For Table Name and Field name, select the table and field that contains the conversion factor for this unit, for each item. For example, in src_rainbow_item, the pallet field might contain the conversion factor for each item.

    The conversion factor for a unit X should give the number of Xs per base unit. For example, for a given SKU if a pallet consists of 100 items, then src_rainbow_item.pallet should be 0.01 for that SKU.

  3. For Aggregate as, select the function to use when aggregating the unit count of multiple sales. You usually use Sum.

    the picture is described in the document text

    See also

    “Configuring Units”

Adding Higher Levels

Note: As you define levels, it is important to consider what sort of forecast tree you will need, as described in “Configuring the Forecast Tree”

To create a higher level

  1. Right-click the level to which you want to add a higher level. Note that any level can have multiple parent levels.

  2. Click Create Relation.

  3. Specify the following items:

    Table Name Select a source table from the drop-down list
    Field Name Select the field within that source table that stores the unique identifiers for members of this level.
    Name Specify a unique name of this level, for internal use.

    As before, Demantra automatically creates a name for the internal table associated with this level.

  4. Create a description for this dimension.

    See also

    “Creating a Level”

Adding Level Attributes

You can store additional level-specific information as attributes. Any number of attributes can be added to a level. Each attribute name must be unique within a given level. To view attributes of a member, the user can right-click the member within the Members Browser of a worksheet or in the Collaborator Workbench.

To create level attributes

  1. In the left box, right-click a level and select Create Attributes.

  2. Complete the fields as follows:

    Table name Table in which attribute data is stored. This should be the source table for this level.
    Field name Field in table that stores this attribute.
    Name Unique internal name for this attribute.
    Attribute Title User-friendly name for this attribute.

    See also

    Adding Attributes to a Level

Defining Other Values

A value can be a causal factor or a data series.

To define a value

  1. In the left box, right-click and then click Create Value.

  2. Select the value item, and then give the value a field name, a name, and a series title.

Impacts of Changing Levels, Series, and Units

This section describes the impact of adding, removing, or modifying levels, series, and units.

For more information about building or updating a model, see Building the Data Model.

Adding a Level

Consultants can add a 'Parentless' level only, in other words, they can add a parent level to an existing level or new branch only. Adding mid-tier levels is not an explicitly supported scenario. Levels can be renamed accordingly to reflect the insertion of a new level between existing levels. See "Creating a New Intermediate Level".

When a new level is created, the upgrade process:

For more information about upgrading a model by adding parent levels, see Creating a New Top Level.

Removing a Level

When a level is removed, any parent levels are also removed. The upgrade script:

Modifying a Level

When a level is modified, the upgrade script:

Adding a Series

All series that need to be part of the loading mechanism must be defined in the data model first in order to be reflected in the loading scripts. They can then be configured more fully by the consultant or user in ‘Configure Series.’

Consultants can add a series to the data model. The series should be added to the loading procedure and related internal tables (sales_data, or mdp_matrix).

Removing a Series

The upgrade process does not remove an existing series from tables, for example, the computed_fields, table. Upgrade only removes the series from the data model, and then removes the series from the loading procedure. Therefore, removing a series will not invalidate objects because the series is still present. However, no data will be loaded to the removed series, so it becomes meaningless over time. Removing a series from the data model accomplishes the following:

Modifying a Series

If a series is modified, the upgrade process does the following:

Adding a Unit

Adding a unit has the following impacts:

Removing a Unit

Removing a unit has the following impacts:

Modifying Time Aggregation

If the time aggregation is modified, this process typically occurs early in an implementation, prior to loading substantial data.

Caution: Any modification to the granularity of the model , whether more granular or less granular, will clear out all data. Reset all worksheets to the new model granularity.

See Setting and Modifying the Base Time Unit.

If a time granularity is modified, the upgrade process reflects the following changes:

Note: Consultant needs to review and re-configure worksheets, workflows, and integration profiles to fully respect the new granularity. The default settings are intended to ensure the worksheets open after the upgrade.

Modifying the First Day of Week

If the First Day of Week is modified, this process typically occurs early in an implementation, prior to loading substantial data.

Caution: Any modification to the First Day of the Week for a model will clear out all data.

Note: The default settings are intended to ensure the worksheets open after the upgrade.

Moving Weekly Bucket Aggregation Forward or Backward

Navigating the Data Model

To navigate the data model

  1. Right-click the white background and then select one of the following options:

    Expand All Open the branches of a data model structure.
    Collapse All Collapse the branches of data model structure to its root level.
    Refresh Tree Update the tree display, with changes since previous refresh.

    See also

    “Configuring Levels”

Building the Data Model

In the Finish Wizard dialog box, you build (or upgrade) the model itself. Here the Data Model Wizard creates all the internal structures that it needs for the data model you have specified.

To build the data model

  1. To Remove Illegal Characters, click Yes to check the source data and remove unwanted characters.

  2. Click Finish or click Build Model.

    If you click Finish, the Data Model Wizard closes.

    If you click Build Model, the Build/Upgrade dialog box appears.

    the picture is described in the document text

  3. Now you can select whether to completely replace the existing data model or just modify it:

    • If you want to completely replace the existing data model, select one of the following options:

      Replace Series Click this to completely replace the existing series definitions.
      Keep Series Click this if you do not want to make any changes to the existing series. This option is suitable if you are in the process of working on the data model but do not want to spend the time updating the series definitions right now.

      Caution: In either case, any previously existing levels are completely removed, and the new levels are initialized.

    • Alternatively, if you are just modifying an existing data model, select Upgrade Existing Model. In this case, if you have made changes to the base time unit, select Run Time Bucket.

      Upgrade Model does not modify the source tables in any way. Any additions, modifications and deletions to these tables would be done manually by consultants. Any level extensions that must be reflected in the loading procedures are managed by the Data Model. Changes made in Series and Level configuration screens are not supported or synchronized.

      Note: There should be no conflicts with the data model definitions (file structures, file locations, and so on). Make sure that the customer's files include all the series and levels that you have configured.

      If there are series or levels that appear in the Business Modeler but that are not included in the components structure, a warning will recommend that you manually remove these objects. A log file is created with a list of the objects. Otherwise, the system will automatically identify the series and levels of the selected components and truncate (make empty) the objects that do not participate in the selected components. Only then can the Upgrade Model work.

  4. Click OK.

    The process of building the data model begins. This may take a few minutes.

    Business Modeler also creates the file load_data.bat. See Loading the Data into the Data Model.

Loading the Data into the Data Model

After completing the data model, you must load the data into it.

To load the data

  1. Run the file load_data.bat, which is in the Demantra/Desktop directory.

    When the file is run, the script imports data from the source files into the staging area, and from there into the Demantra data model.

    The load_data.bat file contains several procedures to help you to load data into the data model. The prepare_data procedure is empty by default, and can be edited to carry out procedures which precede the data loading

    Caution: This should only be carried out by an experienced consultant. It is not recommended to edit the other procedures.

To check for errors

  1. After loading the files, check the following files for error messages:

    • For a single source table (Item+Location+Sales): SRC_sales_err

    • For two source tables (Item, Location + Sales): SRC_loc_err

    • For three source tables (Item, Location, Sales): SRC_item_err

Manipulating Existing Data Models

To open an existing data model or template

  1. Click Data Model > Open Data Model.

    The Open Existing Data Model/Template screen appears.

  2. Select Data Model or Template.

  3. Select the button corresponding to the data model or template you want to modify and click OK.

    The Start Wizard window appears. See “Getting Started with the Data Model Wizard”.

To save a data model or template under a different name

  1. Click Save As (on the Data Model/Template window).

    The Save As dialog box appears.

  2. Type in the name of the data model or template.

  3. Type in an optional description.

  4. Click OK.

To delete a data model or template

  1. Select the Data Model/Template button.

  2. Click Delete.

    A warning window appears.

  3. Click Yes to confirm the action.

To import or export a data model or template

The import and export functions enable you to store a data model or template and share it with other users. Data models and templates are saved as database files with the suffix .dmw.

  1. Select the Data Model/Template radio button.

  2. Click Export.

    A database file is saved in the current directory.

To import a data model or template

  1. Click Import.

    A browser window appears.

  2. Navigate to the required .dmw file, and then click OK.