How do I see the value of one field of a multi-item field in views formatter I have a custom views formatter. 

function template_preprocess_views_view_flot_views_time(&amp;$variables) {
  $view = $variables['view'];
  $field_name = 'foo_bar';
  foreach ($view-&gt;result as $row) {
    $field_value = $view-&gt;field[$field_name]-&gt;getValue($row);
  }
}


This works when the field is a single-value field. However, I have a couple multi-value fields. The result of the above expression is always "1" for these fields. These fields can be identified because

 $view-&gt;field[$field_name]-&gt;multiple == TRUE


I can use 

kint($view-&gt;field[$field_name]-&gt;getItems($row));


to see that this is an array with a render array and raw data.
The value as a string can be found at:

$view-&gt;field[$field_name]-&gt;getItems($row)[0]['rendered'][#markup']


If the multi-value field is named foo, and has three parts, 'bar', 'baz', and 'qux', is there a better way to get the value of foo_bar or foo_baz?

I've been looking at the documentation for core/modules/views/src/Plugin/views/field/Field.php but it's not helping.
You don't need to search for another method, Field::getValue() returns the array you are looking for:

if ($view-&gt;field[$field_name]-&gt;multiple) {
  $field_array = $view-&gt;field[$field_name]-&gt;getValue($row);
}


I don't know if there is a documentation, but you can see this in code:

https://api.drupal.org/api/drupal/core!modules!views!src!Plugin!views!field!Field.php/function/Field%3A%3AgetValue/8.2.x

Difference between field values from view result and entity

If you have a standard multivalue field like text or number in a view and don't change any options, getValue($row) returns a one-dimensional array with the values from the main property of the field. If not you have somehow configured the view so that it shows a different result.

You can although get the original entity field data, which is independent from the configuration of the view. For this the field needs to be in the row entity:

$field_array = $row-&gt;_entity-&gt;{$field_name}-&gt;getValue();


This is then a two-dimensional array with multiple values and multiple properties.