Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client C API Programmer's Guide | Creating and Initializing Events | Regular Data Fields | Getting Regular Field Values
 
Getting Regular Field Values
Several functions are provided for obtaining the value of a regular event data field, based on it's type. These functions are described in awGet<type>Field. The type of the value being retrieved depends on the field's type, as shown below.
Function Name
Value Type
BrokerBoolean
char
char
BrokerDate
double
float
long
BrokerLong
short
char *
charUC
charUC *
The following example contains an excerpt from the subscribe1.c sample application that shows the use of the awGetIntegerField function. The function takes the following parameters:
*A BrokerEvent reference.
*The name of the event field to get.
*The pointer to a location to store the value retrieved from the field.
long pub_count;
. . .
err = awGetIntegerField(e, "count", &pub_count);
if (err != AW_NO_ERROR) {
printf("Error on getting count field\n%s\n", awErrorToString(err));
return 0;
} else {
printf("Event #%d received with count=%d\n",
count, pub_count);
}
. . .
If you attempt to get a field value with a type that does not match the field's defined type, an error may be returned. Type checking will not occur if the event whose field is being obtained was created without a Broker client, as described on Field Type Checking.
You may also use the awGetField to obtain the value and type of an event field.