Apama 10.7.2 | Developing Apama Applications | Developing Apama Applications in EPL | Making Application Data Available to Clients | Creating DataView items
 
Creating DataView items
Use the following event types to create DataView items.
DataViewAddItem
Create and route an event of this type to create a DataView item. This item must not exist already. A response is provided by a DataViewItem or DataViewException event.
Here is an example that creates and routes a DataViewAddItem event, and handles the DataViewItem response by logging the addition of the item:
using com.apama.dataview.DataViewAddItem;
using com.apama.dataview.DataViewItem;
...
string location ;
integer temp;
integer humidity;
integer visibility;
...
DataViewAddItem item := new DataViewAddItem;
item.dvName := "Weather";
item.fieldValues :=
   [location,temp.toString(),humidity.toString(),
   visibility.toString()];
route item;
on DataViewItem (dvName="Weather") as added {
   log("Weather monitor - DataViewItem: " +
      added.dvItemId.toString());
}
DataViewAddOrUpdateItem
Create and route an event of this type to create a DataView item if it does not already exist, or update a DataView item if it already exists. A response is provided by a DataViewItem or DataViewException event.
This will only work when keyFields are used. Any attempts to change the owner of an existing item will be rejected with a DataViewItemException.
DataViewItem
These events are responses to DataViewAddItem events. They indicate the successful creation of a DataView item. The contents of the fields are exactly those of the DataViewAddItem event to which this is a response, except possibly extraParams, and with the addition of the dvItemId field.
DataViewItemException
These events occur under exceptional circumstances in response to DataViewDeleteItem, DataViewUpdateItem or DataViewUpdateItemDelta events.