---
title: Create a computed field for a referenced item
slug: '2238'
canonical_url: https://docs.coveo.com/en/2238/
collection: coveo-for-sitecore-v5
source_format: adoc
---
# Create a computed field for a referenced item
A Sitecore field can reference another Sitecore item, which contains several fields of its own.
Sometimes, you may need to retrieve a field from the referenced item to use it in a computed field.

This can be done using the [`referencedfieldcomputedfield`](https://docs.coveo.com/en/2623#the-referencedfieldcomputedfield-computed-field) computed field.
This article provides an example showing how to use the out-of-the-box `ReferencedFieldComputedField` computed field.
## Scenario
Your content tree contains items of type _Flight_ and items of type _Airport_.
A _Flight_ contains the following fields:
|===
| Field name | Field type | Example value
| Flight Number
| Single-Line Text
| 3836
| Departure Airport
| Droptree (reference)
| Airports/2/3/8/2/0/Amsterdam Airport Schiphol (raw value is actually \{23820EE7-87A3-4265-B785-2A1D25C98F72}).
| Departure Time
| Datetime
| 5/23/2014 10:01 PM
| Arrival Airport
| Droptree (reference)
| Airports/9/C/2/F/4/Los Angeles International Airport (raw value is actually \{9C2F4988-0951-443C-9526-5DBB5D8D9C02}).
| Arrival Time
| Datetime
| 5/24/2014 12:16 AM
| Price
| Single-Line Text
| 586
|===
An _Airport_ contains the following fields:
|===
| Field name | Field type | Example value
| Airport Name
| Single-Line Text
| Amsterdam Airport Schiphol
| Airport Code
| Single-Line Text
| AMS
| City
| Single-Line Text
| Amsterdam
| State
| Single-Line Text
|
| Country
| Single-Line Text
| Netherlands
| Time Zone
| Droplink
| (+1:00) Central Europe Standard Time
| Latitude
| Number
| 52
| Longitude
| Number
| 5
| Aliases
| Single-Line Text
|
|===
Your goal is to populate a `departureairportcity` field in _Flight_ items by retrieving the content of the `City` field from a referenced _Airport_ item.
In other words, you want to do this:

## Step 1: Configure the computed field
Configure your computed field in the Coveo Search Provider configuration file.
. Using a text editor, open the `Coveo.SearchProvider.Custom.config` file (typically located under `App_Config\Include\Coveo`).
. Locate the `fields` element with a `hint` attribute equal to `raw:AddComputedIndexField`.
. Insert the configuration required for your computed field as shown below (that is, just the inner `field` element).
```xml
| Name | Description | Example value |
|---|---|---|
fieldName |
The name of the new field to create | departureairportcity |
sourceField |
The field containing the referenced item's ID | Departure Airport |
referencedFieldName |
The name of the field on the referenced item | City |
returnType |
Return type of the field | The possible values are: Integer, Number, date, datetime, and string. |