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 PC_evn_set_predefined_attr_by_name method.

PC_evn_set_predefined_attr_by_name(n1,
"UserName","Jane",
PC_STRING_TYPE,strlen("Jane"));

PC_evn_set_predefined_attr_by_name(n1,
"Age",&age,PC_LONG_TYPE,0);

PC_evn_set_predefined_attr_by_name(n1,
"Gender",&gender,
PC_CHAR_TYPE,0);

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