---
url: /flow/guide/scripting-reference/classes/data-set/dataset.fields.count.md
---

# Dataset.Fields.Count

## Declaration

`property Fields.Count : integer`

### Example

```pascal
procedure OnMapEvent(var Value:Variant);
begin
LogInfo('Dataview has ' + IntToStr(DATAVIEW.Query.Fields.Count) + ' fields');
end;
```

## Description

Returns the field count for the dataset/Dataview.

When using the Fields.Count property with a Source or Destination Dataview, .Query must be included as shown in the example above. When using the property with a script dataset (including the global datasets Data1, Data2, etc), .Query is not included.

Also note that for a .Query dataset for a Dataview, the dataset will include any fields added by Flow, such as ID and MASTER_ID for a Dataview associated with a File Definition, or "Magic Link" fields for a DB Definition.
