Partilhar via


ComputedField Element (ADF)

Provides a location for defining a computed notification class field.

Syntax

<NotificationClasses>
    <NotificationClass>
        ...
        <Schema>
            ...
            <ComputedFields>
                <ComputedField>

Element Characteristics

Characteristic Description

Data type

None.

Default value

None.

Occurrence

Required once or more per ComputedFields element.

Updates

Can be added and deleted when updating the application.

Element Relationships

Relationship Elements

Parent element

ComputedFields Element (ADF)

Child elements

FieldName Element for NotificationClass/Schema/ComputedFields/ComputedField (ADF)

SqlExpression Element for ComputedField (ADF)

DigestGrouping Element for ComputedField (ADF)

Remarks

Computed fields are never stored in the notifications table. Instead, they are computed immediately before the notification data is passed to the content formatter.

Computed fields allow you to make use of the calculation facilities of Microsoft SQL Server. Use of computed fields can improve the performance of your notification application, can reduce the work that you must do in the content formatter, and enables you to use the rich formatting and conversion capabilities in Transact-SQL.

Important

If you add or delete a ComputedField element, updating the application deletes and re-creates the notification class to which it corresponds. This includes dropping and re-creating the SQL Server tables used by this notification class. Make sure to back up your application database before updating the application.

Example

The following example shows a populated ComputedField element. The computed field converts the stock price into a formatted string.

<ComputedField>
    <FieldName>FormattedStockPrice</FieldName>
    <SqlExpression>CONVERT(NVARCHAR(10), StockPrice, 1)
    </SqlExpression>
</ComputedField>

See Also

Reference

Application Definition File Reference

Other Resources

CAST and CONVERT (Transact-SQL)
Defining the Notification Schema
Updating Instances and Applications

Help and Information

Getting SQL Server 2005 Assistance