Creating common definitions

You can create a set of definitions that can be used by entity loaders, event sequences, and other common definitions. A common definitions is stored in a test client project; there is no limit to the number of common definitions that you can have in the Common Definitions folder.

Before you begin

Before you create a common definitions file, ensure that you have a solution project and completed business object model. You must also create a Test Client project before you create common definitions files.

About this task

You write a set of definitions and save them in a common definitions file.

After you create and define a common definitions, you can reference it from an entity loader, event sequence, or a common definitions by entering the using definitions from: - <common definitions> syntax at the header of the file. This syntax must precede all of the definitions in the file.

Note: Do not create a link between files that depends on each other to function properly. A file cannot reference a common definitions file in which itself is referenced.

Procedure

  1. Create a common definitions file:
    1. In the solution map, click Create common definitions.
    2. In the Common Definitions File wizard, select a solution project in your workspace and enter a name for your common definitions file.
    3. Click Finish.
    The common definitions is saved in the Common Definitions folder in the test client project.
  2. In the common definitions editor, press Space or Ctrl+Space to view the available constructs.
  3. Double-click a construct to insert it in the definition.

    For example, to define a variable that identifies a customer by the ID of John, write the following line: define 'the customer' as the customer identified by "John";

  4. You can add objects to a collection of objects that are related to an event.

    For example, the purchase event type has an attribute named items that includes a price and an amount. The following lines define purchase1 as a new event, which is related to the entity the customer. The add construct adds a new item to the items attribute with specific values for price and amount in the purchase1 event.

    define 'purchase1' as a new purchase where 
       the customer is 'the customer' ;
    add ( a new item where
       the price is 10 ,
       the amount is 1 )
       to the items of purchase1 ;
  5. Save the file.
  6. Optional: In a separate test file, reference a common definitions by entering the using definitions from: <common definitions> construct. For example, you can reference the common definitions by adding the following lines in the header of an entity loader, event sequence, or another common definitions file:
    using definitions from: 
       - "customer_ids" 
       - "items";
    customer_ids and items are the names of the common definitions that you want to reference.
  7. Save the file.

What to do next

Create and load entities, and create and submit events to test the business logic of your project.