Broker 10.15 | webMethods Broker Documentation | webMethods Broker Client C API Programmer's Guide | API Reference | awEvent | awEventToFormattedString
 
awEventToFormattedString
BrokerError awEventToFormattedString(
BrokerEvent event,
char *format_string,
char **result);
event
The event to be formatted.
format_string
The format string to use.
result
The resulting format string. This parameter is used for output.
Formats a string containing specific field values from event, based on the content of format_string. Lines in the resulting string are separated with newline characters '\n'. A pointer to the resulting string is returned in result, which the caller is responsible for freeing.
This function uses the C language locale for formatting event fields with a float, double, or BrokerDate data type.
This function returns an error if the event is invalid, if format_string or result are NULL, or if the string could not be formatted properly.
Several options are available for specifying the format of event fields in format_string.
Format option
Description
s
Encloses the output value in single quotes. Single quotes occurring in the value are escaped with a backslash ("\") character.
d
Encloses the output value in double quotes. Double quotes occurring in the value are escaped with a backslash ("\") character.
q
Provides SQL-style quoting. This is like the :s option, but the escape character is a single quote instead of slash.
v
Replaces each field reference with a bind variable place holder. The default style is :v1, :v2. You can change this option to use ? by calling the awSetFormatMode function.
c
Outputs a numeric value from a field containing a string. Any non-numeric portions of the string field will be discarded. "123x" will become "123".
<number>
Specifies a minimum field length together with one of the options above. The value of string field containing AB with a format option of 5d will result in the output "AB". The field is always left justified and right padded as necessary to meet the field length.
Event fields can be referenced in format_string as follows:
1. Field names must be preceded with a $ character.
2. Field names may optionally be enclosed in curly braces.
3. Format options must be placed at the end of the field name and be separated with a : character.
4. If a minimum field width is specified, it must follow the : delimiter and precede the format specifier.
5. Use a slash to escape any reserved characters, such as the $ character.
You could use either of the following formats to refer to a string field named age:
$age:c
or
${age:c}
See also: