Example: Mapping to multiple tables

This example describes how to map to the device and attribute tables. Remember the roles of these Event Services tables:

  • The eventregister table: Contains one record for every pre-defined event.
  • The eventmap table: There are several out-of-box event maps for adding a new device named inventory add. Each inventory add map contains the instructions to map data for one field.

To view the inventory add map records:

  1. Click Tailoring > Event Services > Maps.
  2. Type inventory add in the blank Map Name field.
  3. Click Search.

    HPE Service Manager displays a list of out-of-box event maps named inventory add.

  4. Select the inventory add event map record where the Position is 9 and the Field Name is type.
  5. Click the Expressions tab. The following expression in the Post Map Instructions identifies the attribute table.

    $attribute.file=type in $axces.target

    This instruction sets the variable $attribute.file to the value in the type field of the device record.

If you view the first inventory add event map records, The Sequence is 1, and the File Name in the map record is device. Notice that each record identifies a different field to be mapped. Until all fields are mapped to the device file, the Sequence remains 1 and File Name remains device.

After the last field for the initial file is mapped, the record is added or updated and a new file is initialized based on the value of $attribute.file.

While $axces.target and$axces.field have special meaning within Event Services, $attribute.file is an arbitrary global variable name.

When all fields are mapped into the device file, the next map record has a Sequence of 2, the File Name is different and a Query is supplied.

  • File Name now contains the value assigned to the $attribute.file variable.
  • Query tells Event Services how to select the record to update from the file identified by $attribute.file. The query can be either a literal statement (as shown in the previous example) or a variable set in previous Post Map Instruction or Initialization fields.

The first mapping for the new file is logical.name, which is stored in Position 1 (as shown in the previous example) of the evfields array field, which is represented by the $axces.fields variable in the eventin record.

Subsequent map records move data from the eventin record to the new file. When updating an existing record, Event Services substitutes the value in the original record for a null value passed from the eventin record.