What Does Delta Mean in Drupal?

| Drupal
drupal delta

When you are adding Views, you may have seen an extra option called "Delta".

Several students have asked us about the purpose of this field, because it wasn't clear.

The Delta option is available throughout the site, but ordinary users are most likely to encounter it inside Views. Here's how the "Delta" options appear in Views:

Delta option in Drupal views

And here's how the Delta fields appear if you add them to your view. It's really not something you're likely to want to display.

Delta fields added to Views

So what does "Delta" mean?

"Delta" only appears fields which have multiple value. "Delta" refers to the order of the values:

  • 0 is the first item
  • 1 is the second item
  • 2 is the third item etc.

You can use Delta to restrict the results you show. For example, you might only want to show the first and third items stored in a field.

The Delta option isn't available only in Views. With the "Image Delta Formatter" module, you can use Delta to display fields. In example below, we're using "0,2" to only show the first and third images:

Image Delta Formatter module

If you go to the database and find the table for a field with multiple values, you'll see that the Delta is stored here:

Delta column in Drupal database

Let's take another example. Imagine that you have a Date field set up in Drupal 7, and you allow people to choose to repeat the date.

Repating date in Drupal

In this situation, every possible repeating date will be stored in the database, with it's own Delta. The use of the "Delta" fields allows you choose only some of the many possible dates.

Choosing dates in Drupal usign Delta

About the author

Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.