Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client C API Programmer's Guide | Creating and Initializing Events | Sequence Data Fields | Setting Sequence Fields
 
Setting Sequence Fields
Several functions are provided for setting the values of the entire sequence, or a subset of the sequence. These functions are described in awSet<type>SeqField.
You may also use the awSet<type>Field to set a single value within a sequence field by specifying the field name with an index.
The following example shows the use of the awSetIntegerSeqField function. The function takes the following parameters:
*A BrokerEvent reference.
*The name of the event sequence field to be set.
*The number of elements to skip from the beginning of the source array parameter.
*The number of elements to skip from the beginning of the target sequence in the event.
*The number of elements to be set.
*The source array of values of the appropriate type.
long count[5] = { 0, 1, 2, 3, 4};
long count_ptr = &count;
. . .
err = awSetIntegerSeqField(e, "countSeq", 0, 0, 5, count_ptr);
if (err != AW_NO_ERROR) {
printf("Error on setting event sequence field\n%s\n",
awErrorToString(err));
return 0;
}
. . .
The manner in which the source array is specified depends on the array's type.
Function Name
Value Type
awSetBooleanSeqField
BrokerBoolean *
awSetByteSeqField
char *
awSetCharSeqField
char *
awSetDateSeqField
BrokerDate *
awSetDoubleSeqField
double *
awSetFloatSeqField
float *
awSetIntegerSeqField
long *
awSetLongSeqField
BrokerLong *
awSetShortSeqField
short *
awSetStringSeqField
char **
awSetUCCharSeqField
charUC *
awSetUCStringSeqField
charUC **
Each of the awSet<type>SeqField functions may overwrite all or part of the destination sequence field. After the code shown in the example on Setting Sequence Fields is executed, the sequence will contain:
[0 1 2 3 4]
If you then set three elements (3, 2, 1) into this same sequence at location 1, the sequence would then appear as:
[0 3 2 1 4]
An error will be returned if you attempt to set a field with a value that does not match its defined type.
These functions may also cause the destination sequence to grow in size, if a larger number of elements are stored into the sequence.
These functions never reduce the number of elements in the destination sequence: Use the awSetSequenceFieldSize function to reduce the size of a sequence field.