# C1.PivotEngine.C1PivotEngine.Fields

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_PivotEngine_C1PivotEngine_Fields_" data-uid="C1.PivotEngine.C1PivotEngine.Fields*">Fields Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_PivotEngine_C1PivotEngine_Fields_" data-uid="C1.PivotEngine.C1PivotEngine.Fields*"></a>
<h4 id="C1_PivotEngine_C1PivotEngine_Fields" data-uid="C1.PivotEngine.C1PivotEngine.Fields">Fields</h4>
<div class="markdown level1 summary"><p>Gets the list of <a class="xref" href="C1.PivotEngine.PivotField.html">PivotField</a> objects exposed by
the data source.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public PivotFieldList Fields { get; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public ReadOnly Property Fields As PivotFieldList</code></pre>
</div>
<h5 id="C1_PivotEngine_C1PivotEngine_Fields_remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This list is created automatically whenever the <a class="xref" href="C1.PivotEngine.C1PivotEngine.DataSource.html#C1_PivotEngine_C1PivotEngine_DataSource">DataSource</a>
property is set.</p>
<p>PivotEngine views are defined by copying fields from this list to
the lists that define the view: <a class="xref" href="C1.PivotEngine.C1PivotEngine.ValueFields.html#C1_PivotEngine_C1PivotEngine_ValueFields">ValueFields</a>, <a class="xref" href="C1.PivotEngine.C1PivotEngine.RowFields.html#C1_PivotEngine_C1PivotEngine_RowFields">RowFields</a>,
<a class="xref" href="C1.PivotEngine.C1PivotEngine.ColumnFields.html#C1_PivotEngine_C1PivotEngine_ColumnFields">ColumnFields</a>, and <a class="xref" href="C1.PivotEngine.C1PivotEngine.FilterFields.html#C1_PivotEngine_C1PivotEngine_FilterFields">FilterFields</a>.</p>
</div>
<h5 id="C1_PivotEngine_C1PivotEngine_Fields_examples">Examples</h5>
<p>The code below assigns a data source to the PivotEngine and then defines
a view by adding fields to each of the <a class="xref" href="C1.PivotEngine.C1PivotEngine.RowFields.html#C1_PivotEngine_C1PivotEngine_RowFields">RowFields</a>,
<a class="xref" href="C1.PivotEngine.C1PivotEngine.ColumnFields.html#C1_PivotEngine_C1PivotEngine_ColumnFields">ColumnFields</a>, and <a class="xref" href="C1.PivotEngine.C1PivotEngine.ValueFields.html#C1_PivotEngine_C1PivotEngine_ValueFields">ValueFields</a> lists.</p>
<pre><code class="lang-csharp">// set data source (populates Fields list)
fp.DataSource = GetDataTable();

// prevent updates while building PivotEngine view
fp.BeginUpdate();

// show countries in rows
fp.RowFields.Add("Country");

// show categories and products in columns
fp.ColumnFields.Add("Category");
fp.ColumnFields.Add("Product");

// show total sales in cells
fp.ValueFields.Add("Sales");

// done defining the view
fp.EndUpdate();</code></pre>

</div>
