--- title: Use out-of-the-box computed fields slug: '2623' canonical_url: https://docs.coveo.com/en/2623/ collection: coveo-for-sitecore-v5 source_format: adoc --- # Use out-of-the-box computed fields Coveo for Sitecore includes out-of-the-box implementations that let you add computed fields for common use cases without any coding on your part. Coveo for Sitecore also provides commented out field indexing configurations for these computed fields in the `Coveo.SearchProvider.Custom.config` file, in the `` section. You only need to provide a few attribute values and enable the configuration to have your computed fields added on indexing. > **Note** > > This configuration lets you create and index the computed field. > To apply special settings to that field (for example, to use it as a facet or to sort results), you also need to [add a configuration in the `fieldNames` section](https://docs.coveo.com/en/2166/) of the configuration file. This article explains how to use the three Coveo for Sitecore computed field implementations. These computed fields share a common logic in that they let you retrieve a value stored in a referenced item field. ![Logic behind Coveo for Sitecore out-of-the-box computed fields | Coveo for Sitecore 5](https://docs.coveo.com/en/assets/images/c4sc-v5/out-of-the-box-computed-fields.png) The [`ReferencedFieldComputedField`](#the-referencedfieldcomputedfield-computed-field) computed field is a generic implementation that lets you pick a field from the referenced item, whereas the referenced item field is hard-coded in [`ImageUrlComputedField`](#the-imageurlcomputedfield-computed-field) and [`ImageAltComputedField`](#the-imagealtcomputedfield-computed-field). > **Note** > > In the **Fields** page of the **Command Center**, the **Computed** tab displays all computed fields you add or create, along with Sitecore's own computed fields. > > ![Image showing sample content of Computed fields in the Command Center | Coveo for Sitecore 5](:https://docs.coveo.com/en/assets/images/c4sc-v5/computed-fields-in-command-center.png) ## The `ReferencedFieldComputedField` computed field This computed field retrieves a specific field from an item referenced by a field. For example, you could have an item that has a `MediaItem` field of type `Droptree`, which refers to a `File` item containing a `Mime Type` field of type `text`. You can also see the [Create a computed field for a referenced item](https://docs.coveo.com/en/2238/) article for a concrete example implementation of this computed field. To create a new field named `mimetype` on the original item and which contains the MIME type of the file, add the following element in your configuration and rebuild your search indexes: ```xml Coveo.SearchProvider.ComputedFields.ReferencedFieldComputedField, Coveo.SearchProviderBase ``` Here are the properties and what they refer to: * `fieldName`: The resulting name of the field in the Coveo index. * `sourceField`: The name of the field in your indexable item that have a value to be replaced. * `referencedFieldName`: The name of the field on the referenced item that contains the value to be used. > **Note** > > The value returned by the computed field is automatically converted to string by default. > You can change this behavior by setting the `returnType` attribute to one of the supported Sitecore data types (that is, `Integer`, `Number`, `date`, `datetime`, or `string`). > **Important** > > Don't use special characters in computed field names. ## The `ImageUrlComputedField` computed field This computed field retrieves the URL of an image referenced by a field of type _Image_. For example, you could have an item that has a field named `screenshot` of type Image, and that references an image in the Media Library. To create a new field containing the URL of the image, add the following element in your configuration and rebuild your search indexes: ```xml Coveo.SearchProvider.ComputedFields.ImageUrlComputedField, Coveo.SearchProviderBase ``` > **Important** > > Don't use special characters in computed field names. > **Leading practice** > > Use the retrieved URL to [add the Media Library image in a result template](https://docs.coveo.com/en/2834/). ## The `ImageAltComputedField` computed field This computed field retrieves the alternate text (ALT) of an image referenced by a field of type Image. Given the same scenario as `ImageUrlComputedField`, add the following element in your configuration and rebuild your search indexes to create a new field containing the alternate text of the image: ```xml Coveo.SearchProvider.ComputedFields.ImageAltComputedField, Coveo.SearchProviderBase ``` > **Important** > > Don't use special characters in computed field names.