PreCache NetInjector Documentation Center : PreCache NetInjector Application Development

Common Cases, Publication — C++

   







Notifications with predefined attributes

— assigning values to predefined attributes


When publishing content, you construct your notification by assigning value to predefined attributes. In the first tutorial, we set a value for one predefined attribute of Channel 7, Message.

In the Sample.Chat subject of Channel 40, we set values for four predefined attributes: Message, Username, Age, and Gender. These four predefined attributes and their values are of three different data types:

Message, Username —
PC_STRING

Age —
PC_LONG

Gender —
PC_CHAR

The data types for these attributes were set when the NetInjector administrator configured the channel.

To set the values for these attributes, we call the Notification class's SetPredefinedAttr method.

n1.SetPredefinedAttr("UserName","Jane");

n1.SetPredefinedAttr("Age",(PC_LONG)10);

n1.SetPredefinedAttr("Gender",'F');

Note: For each attribute, we set the attribute by name. Attribute values may also be set by position.