GwEnrichEvent()

The GwEnrichEvent(); updates fields in an event. Any data can be added to an event using this rule; however, the only fields which are permitted to update the ObjectServer alerts.status table are those fields that are listed in the outgoing field filter, as defined in the in the FieldFilter section of the nco2ncp table within the EventGatewaySchema.cfg configuration file.

Syntax

The GwEnrichEvent(); statement uses the following syntax.

GwEnrichEvent ( [optional serial number], enrichedFields );

Arguments

The following table lists the properties of the arguments of this stitcher rule.
Table 1. Arguments of GwEnrichEvent()
Argument Description Accepts constants Accepts variables Accepts eval clauses
optional serial number Identifies the event to be updated. If no serial number is supplied, it is assumed that the current top-level in-scope event is being updated. If iterating through a loop (for example, the contents of a RecordList), the event is still the top-level event that was in-scope at the start of the stitcher, and not the current in-scope record within the loop.
Note: The Event Gateway stitchers always have the event as the top-level in-scope record.
Yes Yes Yes
enrichedFields Record listing the fields to use to enrich the event. These fields are added to the event or update existing fields in the event. Yes Yes Yes

Returns

This stitcher does not return any values.

Updating the current in-scope event

The following example shows how the GwEnrichEvent(); rule is used to update the current in-scope record.
Both fields specified as part of the enrichment record are added to the current in-scope record. However, only the MyCustomField column of the alerts.status table is actually updated in the ObjectServer because the FieldUsedByRca field is not listed as a permitted field in the outgoing field filter.
// define the fields to add or update
Record enrichment;
@enrichment.MyCustomfield = "any value I choose for this text field";
@enrichment.FieldUsedByRca = 59;

GwEnrichEvent( enrichment );

Updating an event with a specified serial number

The following example shows how the GwEnrichEvent(); rule is used to update an event with a specified serial number. This example works exactly as the previous example, except that the top-level in-scope record is modified if and only if it has a serial number of 345. If the event does not have serial number 345, then the alerts.status table is updated for that seial number, but the in-scope record remains unaltered.
// define the fields to add or update
Record enrichment;
@enrichment.MyCustomfield = "any value I choose for this text field";
@enrichment.FieldUsedByRca = 59;

GwEnrichEvent( 345, enrichment );